Class: Pago::V2026_04::Services::Checkouts
- Defined in:
- lib/pago/v2026_04/services/checkouts.rb,
sig/pago/v2026_04/generated.rbs
Instance Attribute Summary
Attributes inherited from Service
Instance Method Summary collapse
-
#client_confirm(client_secret, body: {}) ⇒ Models::CheckoutPublicConfirmed
Confirm a checkout session by client secret.
-
#client_get(client_secret) ⇒ Models::CheckoutPublic
Get a checkout session by client secret.
-
#client_update(client_secret, body: {}) ⇒ Models::CheckoutPublic
Update a checkout session by client secret.
-
#create(body: {}) ⇒ Models::Checkout
Create a checkout session.
-
#get(id) ⇒ Models::Checkout
Get a checkout session by ID.
-
#list(organization_id: nil, product_id: nil, customer_id: nil, external_customer_id: nil, status: nil, query: nil, page: 1, limit: 10, sorting: ["-created_at"]) ⇒ Models::ListResourceCheckout
List checkout sessions.
-
#list_each(organization_id: nil, product_id: nil, customer_id: nil, external_customer_id: nil, status: nil, query: nil, limit: 10, sorting: ["-created_at"]) {|item| ... } ⇒ Pago::Paginator
Enumerate every item of
list, fetching pages on demand. -
#update(id, body: {}) ⇒ Models::Checkout
Update a checkout session.
Methods inherited from Service
Constructor Details
This class inherits a constructor from Pago::Service
Instance Method Details
#client_confirm(client_secret, body: {}) ⇒ Models::CheckoutPublicConfirmed
Confirm a checkout session by client secret.
Orders and subscriptions will be processed.
168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/pago/v2026_04/services/checkouts.rb', line 168 def client_confirm(client_secret, body: {}) data = client.request( http_method: "POST", path: "/v1/checkouts/client/{client_secret}/confirm", path_params: { "client_secret" => client_secret }, query: {}, body: body, response_type: :json, errors: { 400 => Errors::PaymentError, 403 => Errors::ClientConfirm403Error, 404 => Errors::ResourceNotFound, 410 => Errors::ExpiredCheckoutError, 422 => Errors::HTTPValidationError } ) Models::CheckoutPublicConfirmed.from_json(data) end |
#client_get(client_secret) ⇒ Models::CheckoutPublic
Get a checkout session by client secret.
120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/pago/v2026_04/services/checkouts.rb', line 120 def client_get(client_secret) data = client.request( http_method: "GET", path: "/v1/checkouts/client/{client_secret}", path_params: { "client_secret" => client_secret }, query: {}, response_type: :json, errors: { 404 => Errors::ResourceNotFound, 410 => Errors::ExpiredCheckoutError, 422 => Errors::HTTPValidationError } ) Models::CheckoutPublic.from_json(data) end |
#client_update(client_secret, body: {}) ⇒ Models::CheckoutPublic
Update a checkout session by client secret.
142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/pago/v2026_04/services/checkouts.rb', line 142 def client_update(client_secret, body: {}) data = client.request( http_method: "PATCH", path: "/v1/checkouts/client/{client_secret}", path_params: { "client_secret" => client_secret }, query: {}, body: body, response_type: :json, errors: { 403 => Errors::ClientUpdate403Error, 404 => Errors::ResourceNotFound, 410 => Errors::ExpiredCheckoutError, 422 => Errors::HTTPValidationError } ) Models::CheckoutPublic.from_json(data) end |
#create(body: {}) ⇒ Models::Checkout
Create a checkout session.
Scopes: checkouts:write
54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/pago/v2026_04/services/checkouts.rb', line 54 def create(body: {}) data = client.request( http_method: "POST", path: "/v1/checkouts/", path_params: {}, query: {}, body: body, response_type: :json, errors: { 422 => Errors::HTTPValidationError } ) Models::Checkout.from_json(data) end |
#get(id) ⇒ Models::Checkout
Get a checkout session by ID.
Scopes: checkouts:read checkouts:write
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/pago/v2026_04/services/checkouts.rb', line 76 def get(id) data = client.request( http_method: "GET", path: "/v1/checkouts/{id}", path_params: { "id" => id }, query: {}, response_type: :json, errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) Models::Checkout.from_json(data) end |
#list(organization_id: nil, product_id: nil, customer_id: nil, external_customer_id: nil, status: nil, query: nil, page: 1, limit: 10, sorting: ["-created_at"]) ⇒ Models::ListResourceCheckout
List checkout sessions.
Scopes: checkouts:read checkouts:write
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/pago/v2026_04/services/checkouts.rb', line 23 def list(organization_id: nil, product_id: nil, customer_id: nil, external_customer_id: nil, status: nil, query: nil, page: 1, limit: 10, sorting: ["-created_at"]) data = client.request( http_method: "GET", path: "/v1/checkouts/", path_params: {}, query: { "organization_id" => organization_id, "product_id" => product_id, "customer_id" => customer_id, "external_customer_id" => external_customer_id, "status" => status, "query" => query, "page" => page, "limit" => limit, "sorting" => sorting }, response_type: :json, errors: { 422 => Errors::HTTPValidationError } ) Models::ListResourceCheckout.from_json(data) end |
#list_each(organization_id: nil, product_id: nil, customer_id: nil, external_customer_id: nil, status: nil, query: nil, limit: 10, sorting: ["-created_at"]) {|item| ... } ⇒ Pago::Paginator
Enumerate every item of list, fetching pages on demand.
39 40 41 42 43 44 |
# File 'lib/pago/v2026_04/services/checkouts.rb', line 39 def list_each(organization_id: nil, product_id: nil, customer_id: nil, external_customer_id: nil, status: nil, query: nil, limit: 10, sorting: ["-created_at"], &block) paginator = ::Pago::Paginator.new do |page_number| list(organization_id: organization_id, product_id: product_id, customer_id: customer_id, external_customer_id: external_customer_id, status: status, query: query, page: page_number, limit: limit, sorting: sorting) end block ? paginator.each(&block) : paginator end |
#update(id, body: {}) ⇒ Models::Checkout
Update a checkout session.
Scopes: checkouts:write
99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/pago/v2026_04/services/checkouts.rb', line 99 def update(id, body: {}) data = client.request( http_method: "PATCH", path: "/v1/checkouts/{id}", path_params: { "id" => id }, query: {}, body: body, response_type: :json, errors: { 403 => Errors::Update403Error, 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) Models::Checkout.from_json(data) end |