Class: Nombaone::Resources::PaymentMethods
- Inherits:
-
BaseResource
- Object
- BaseResource
- Nombaone::Resources::PaymentMethods
- Defined in:
- lib/nombaone/resources/payment_methods.rb,
sig/nombaone/resources.rbs
Overview
Payment methods — cards (via hosted checkout), direct-debit mandates (see
nombaone.mandates), and virtual accounts for the transfer rail.
Card and mandate are pull rails (the engine initiates the debit); a virtual account is the push rail (the customer sends a transfer and the engine matches it — never treat a collect as instantly final).
Instance Method Summary collapse
-
#create_virtual_account(customer_ref:, expected_amount: OMIT, expiry_date: OMIT, request_options: {}) ⇒ NombaObject
Issue a dedicated virtual account (NUBAN) so the customer can pay by bank transfer.
-
#list(customer_ref: OMIT, limit: OMIT, cursor: OMIT, request_options: {}) ⇒ Page<NombaObject>
List payment methods, newest first.
-
#remove(id, request_options: {}) ⇒ NombaObject
Detach a payment method.
-
#retrieve(id, request_options: {}) ⇒ NombaObject
Retrieve a payment method by id.
-
#set_default(id, request_options: {}) ⇒ NombaObject
Make this the customer's default payment method.
-
#setup(customer_ref:, amount_in_kobo:, callback_url:, request_options: {}) ⇒ NombaObject
Start a hosted-checkout card capture.
Methods inherited from BaseResource
#encode, #initialize, #request, #request_page
Constructor Details
This class inherits a constructor from Nombaone::Resources::BaseResource
Instance Method Details
#create_virtual_account(customer_ref:, expected_amount: OMIT, expiry_date: OMIT, request_options: {}) ⇒ NombaObject
Issue a dedicated virtual account (NUBAN) so the customer can pay by bank transfer. The engine matches inbound transfers to invoices by reference and exact integer-kobo amount.
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/nombaone/resources/payment_methods.rb', line 46 def create_virtual_account(customer_ref:, expected_amount: OMIT, expiry_date: OMIT, request_options: {}) request(:post, "/payment-methods/virtual-account", body: { customer_ref: customer_ref, expected_amount: expected_amount, expiry_date: expiry_date, }, options: ) end |
#list(customer_ref: OMIT, limit: OMIT, cursor: OMIT, request_options: {}) ⇒ Page<NombaObject>
List payment methods, newest first.
75 76 77 78 79 |
# File 'lib/nombaone/resources/payment_methods.rb', line 75 def list(customer_ref: OMIT, limit: OMIT, cursor: OMIT, request_options: {}) request_page("/payment-methods", query: { customer_ref: customer_ref, limit: limit, cursor: cursor }, options: ) end |
#remove(id, request_options: {}) ⇒ NombaObject
Detach a payment method. Subscriptions still billing against it will
need a replacement (SUBSCRIPTION_PAYMENT_METHOD_REQUIRED at next charge
otherwise).
97 98 99 |
# File 'lib/nombaone/resources/payment_methods.rb', line 97 def remove(id, request_options: {}) request(:delete, "/payment-methods/#{encode(id)}", options: ) end |
#retrieve(id, request_options: {}) ⇒ NombaObject
Retrieve a payment method by id.
63 64 65 |
# File 'lib/nombaone/resources/payment_methods.rb', line 63 def retrieve(id, request_options: {}) request(:get, "/payment-methods/#{encode(id)}", options: ) end |
#set_default(id, request_options: {}) ⇒ NombaObject
Make this the customer's default payment method.
86 87 88 |
# File 'lib/nombaone/resources/payment_methods.rb', line 86 def set_default(id, request_options: {}) request(:post, "/payment-methods/#{encode(id)}/default", body: {}, options: ) end |
#setup(customer_ref:, amount_in_kobo:, callback_url:, request_options: {}) ⇒ NombaObject
Start a hosted-checkout card capture. Card entry happens on the PCI
hosted page — no card data ever touches your servers. The method appears
as setup_pending until the customer completes checkout.
27 28 29 30 31 32 33 34 35 |
# File 'lib/nombaone/resources/payment_methods.rb', line 27 def setup(customer_ref:, amount_in_kobo:, callback_url:, request_options: {}) request(:post, "/payment-methods/setup", body: { customer_ref: customer_ref, amount_in_kobo: amount_in_kobo, callback_url: callback_url, }, options: ) end |