Class: Pago::V2026_04::Services::Checkouts

Inherits:
Service
  • Object
show all
Defined in:
lib/pago/v2026_04/services/checkouts.rb,
sig/pago/v2026_04/generated.rbs

Instance Attribute Summary

Attributes inherited from Service

#client

Instance Method Summary collapse

Methods inherited from Service

#initialize

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.

Parameters:

  • client_secret (String)

    The checkout session client secret.

  • body (Hash, Models::CheckoutConfirmStripe) (defaults to: {})

    the request body.

  • body: (Object) (defaults to: {})

Returns:

Raises:



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.

Parameters:

  • client_secret (String)

    The checkout session client secret.

Returns:

Raises:



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.

Parameters:

  • client_secret (String)

    The checkout session client secret.

  • body (Hash, Models::CheckoutUpdatePublic) (defaults to: {})

    the request body.

  • body: (Object) (defaults to: {})

Returns:

Raises:



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

Parameters:

  • body (Hash, Models::CheckoutCreate) (defaults to: {})

    the request body.

  • body: (Object) (defaults to: {})

Returns:

Raises:



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

Parameters:

  • id (String)

    The checkout session ID.

Returns:

Raises:



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

Parameters:

  • organization_id (String, Array<String>, nil) (defaults to: nil)

    Filter by organization ID.

  • product_id (String, Array<String>, nil) (defaults to: nil)

    Filter by product ID.

  • customer_id (String, Array<String>, nil) (defaults to: nil)

    Filter by customer ID.

  • external_customer_id (String, Array<String>, nil) (defaults to: nil)

    Filter by customer external ID.

  • status (String, Array<String>, nil) (defaults to: nil)

    Filter by checkout session status.

  • query (String, nil) (defaults to: nil)

    Filter by customer email.

  • page (Integer) (defaults to: 1)

    Page number, defaults to 1.

  • limit (Integer) (defaults to: 10)

    Size of a page, defaults to 10. Maximum is 100.

  • sorting (Array<String>, nil) (defaults to: ["-created_at"])

    Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign - before the criteria name to sort by descending order.

  • organization_id: (Object) (defaults to: nil)
  • product_id: (Object) (defaults to: nil)
  • customer_id: (Object) (defaults to: nil)
  • external_customer_id: (Object) (defaults to: nil)
  • status: (Object) (defaults to: nil)
  • query: (String, nil) (defaults to: nil)
  • page: (Integer, nil) (defaults to: 1)
  • limit: (Integer, nil) (defaults to: 10)
  • sorting: (Array[String], nil) (defaults to: ["-created_at"])

Returns:

Raises:



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.

Parameters:

  • organization_id: (Object) (defaults to: nil)
  • product_id: (Object) (defaults to: nil)
  • customer_id: (Object) (defaults to: nil)
  • external_customer_id: (Object) (defaults to: nil)
  • status: (Object) (defaults to: nil)
  • query: (String, nil) (defaults to: nil)
  • limit: (Integer, nil) (defaults to: 10)
  • sorting: (Array[String], nil) (defaults to: ["-created_at"])

Yield Parameters:

Returns:



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

Parameters:

  • id (String)

    The checkout session ID.

  • body (Hash, Models::CheckoutUpdate) (defaults to: {})

    the request body.

  • body: (Object) (defaults to: {})

Returns:

Raises:



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