Class: AbacatePay::Clients::PaymentLinkClient
- Defined in:
- lib/abacate_pay/clients/payment_link_client.rb
Overview
Client for reusable payment links in the AbacatePay API.
A payment link can be paid by many customers independently — mass sales, raffles, sign-up forms — without creating one checkout per customer. Use CheckoutClient when each customer needs their own charge.
Constant Summary collapse
- URI =
"payment-links"- FREQUENCY =
Payment links are always multi-payment by definition; the API rejects any other frequency on this endpoint.
"MULTIPLE_PAYMENTS"
Constants inherited from Client
Client::RETRIABLE_EXCEPTIONS, Client::RETRIABLE_METHODS, Client::RETRIABLE_STATUSES
Instance Method Summary collapse
-
#create(data) ⇒ Resources::Checkouts
Creates a reusable payment link.
- #get(id) ⇒ Resources::Checkouts
-
#initialize(client = nil) ⇒ PaymentLinkClient
constructor
A new instance of PaymentLinkClient.
- #list(**params) ⇒ Array<Resources::Checkouts>
-
#refund(id) ⇒ Resources::Checkouts
Refunds a payment made through the link.
Methods inherited from Client
Constructor Details
#initialize(client = nil) ⇒ PaymentLinkClient
Returns a new instance of PaymentLinkClient.
18 19 20 |
# File 'lib/abacate_pay/clients/payment_link_client.rb', line 18 def initialize(client = nil) super(URI, client) end |
Instance Method Details
#create(data) ⇒ Resources::Checkouts
Creates a reusable payment link.
40 41 42 43 |
# File 'lib/abacate_pay/clients/payment_link_client.rb', line 40 def create(data) response = request("POST", "create", json: build_create_payload(data)) Resources::Checkouts.new(response) end |
#get(id) ⇒ Resources::Checkouts
31 32 33 34 |
# File 'lib/abacate_pay/clients/payment_link_client.rb', line 31 def get(id) response = request("GET", "get", params: { id: id }) Resources::Checkouts.new(response) end |
#list(**params) ⇒ Array<Resources::Checkouts>
24 25 26 27 |
# File 'lib/abacate_pay/clients/payment_link_client.rb', line 24 def list(**params) response = request("GET", "list", params: params.empty? ? nil : params) build_list(response, Resources::Checkouts) end |
#refund(id) ⇒ Resources::Checkouts
Refunds a payment made through the link.
49 50 51 52 |
# File 'lib/abacate_pay/clients/payment_link_client.rb', line 49 def refund(id) response = request("POST", "refund", json: { id: id }) Resources::Checkouts.new(response) end |