Class: AbacatePay::Clients::CheckoutClient
- Defined in:
- lib/abacate_pay/clients/checkout_client.rb
Overview
Client for one-off checkout sessions in the AbacatePay API.
Checkouts are single-payment links; use SubscriptionClient for recurring charges.
Constant Summary collapse
- URI =
"checkouts"
Constants inherited from Client
AbacatePay::Clients::Client::RETRIABLE_EXCEPTIONS, AbacatePay::Clients::Client::RETRIABLE_METHODS, AbacatePay::Clients::Client::RETRIABLE_STATUSES
Instance Method Summary collapse
- #create(data) ⇒ Resources::Checkouts
- #get(id) ⇒ Resources::Checkouts
-
#initialize(client = nil) ⇒ CheckoutClient
constructor
A new instance of CheckoutClient.
- #list(**params) ⇒ Array<Resources::Checkouts>
-
#refund(id) ⇒ Resources::Checkouts
Refunds a paid checkout in full.
Methods inherited from Client
Constructor Details
#initialize(client = nil) ⇒ CheckoutClient
Returns a new instance of CheckoutClient.
12 13 14 |
# File 'lib/abacate_pay/clients/checkout_client.rb', line 12 def initialize(client = nil) super(URI, client) end |
Instance Method Details
#create(data) ⇒ Resources::Checkouts
32 33 34 35 |
# File 'lib/abacate_pay/clients/checkout_client.rb', line 32 def create(data) response = request("POST", "create", json: build_create_payload(data)) Resources::Checkouts.new(response) end |
#get(id) ⇒ Resources::Checkouts
25 26 27 28 |
# File 'lib/abacate_pay/clients/checkout_client.rb', line 25 def get(id) response = request("GET", "get", params: { id: id }) Resources::Checkouts.new(response) end |
#list(**params) ⇒ Array<Resources::Checkouts>
18 19 20 21 |
# File 'lib/abacate_pay/clients/checkout_client.rb', line 18 def list(**params) response = request("GET", "list", params: params.empty? ? nil : params) build_list(response, Resources::Checkouts) end |
#refund(id) ⇒ Resources::Checkouts
Refunds a paid checkout in full. AbacatePay does not support partial refunds — the original amount is always returned.
43 44 45 46 |
# File 'lib/abacate_pay/clients/checkout_client.rb', line 43 def refund(id) response = request("POST", "refund", json: { id: id }) Resources::Checkouts.new(response) end |