Nombaone. PaymentMethods
(Nomba One v0.1.0)
View Source
Payment methods — cards (via hosted checkout), direct-debit mandates (see
Nombaone.Mandates), and virtual accounts for the transfer rail.
Every function returns {:ok, result} or {:error, %Nombaone.Error{}} and
has a raising ! variant.
Summary
Functions
Issue a dedicated virtual account (NUBAN) so the customer can pay by bank transfer. Bank transfer is a push rail: collection completes when the transfer arrives and reconciles — never treat it as instantly final.
Raising variant of create_virtual_account/3.
List payment methods, newest first. Optional filters: :customer_ref (note the wire name), :limit, :cursor.
Raising variant of list/3.
Detach a payment method. Subscriptions still billing against it will need a
replacement (SUBSCRIPTION_PAYMENT_METHOD_REQUIRED at next charge otherwise).
Raising variant of remove/3.
Retrieve a payment method by id. Common errors: 404 PAYMENT_METHOD_NOT_FOUND.
Raising variant of retrieve/3.
Make this the customer's default payment method.
Raising variant of set_default/3.
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. Redirect them to the
returned checkout_link.
Raising variant of setup/3.
Functions
@spec create_virtual_account(Nombaone.Client.t(), map(), keyword()) :: {:ok, Nombaone.VirtualAccount.t()} | {:error, Nombaone.Error.t()}
Issue a dedicated virtual account (NUBAN) so the customer can pay by bank transfer. Bank transfer is a push rail: collection completes when the transfer arrives and reconciles — never treat it as instantly final.
@spec create_virtual_account!(Nombaone.Client.t(), map(), keyword()) :: Nombaone.VirtualAccount.t()
Raising variant of create_virtual_account/3.
@spec list(Nombaone.Client.t(), map(), keyword()) :: {:ok, Nombaone.Page.t()} | {:error, Nombaone.Error.t()}
List payment methods, newest first. Optional filters: :customer_ref (note the wire name), :limit, :cursor.
@spec list!(Nombaone.Client.t(), map(), keyword()) :: Nombaone.Page.t()
Raising variant of list/3.
@spec remove(Nombaone.Client.t(), String.t(), keyword()) :: {:ok, Nombaone.PaymentMethod.t()} | {:error, Nombaone.Error.t()}
Detach a payment method. Subscriptions still billing against it will need a
replacement (SUBSCRIPTION_PAYMENT_METHOD_REQUIRED at next charge otherwise).
@spec remove!(Nombaone.Client.t(), String.t(), keyword()) :: Nombaone.PaymentMethod.t()
Raising variant of remove/3.
@spec retrieve(Nombaone.Client.t(), String.t(), keyword()) :: {:ok, Nombaone.PaymentMethod.t()} | {:error, Nombaone.Error.t()}
Retrieve a payment method by id. Common errors: 404 PAYMENT_METHOD_NOT_FOUND.
@spec retrieve!(Nombaone.Client.t(), String.t(), keyword()) :: Nombaone.PaymentMethod.t()
Raising variant of retrieve/3.
@spec set_default(Nombaone.Client.t(), String.t(), keyword()) :: {:ok, Nombaone.PaymentMethod.t()} | {:error, Nombaone.Error.t()}
Make this the customer's default payment method.
@spec set_default!(Nombaone.Client.t(), String.t(), keyword()) :: Nombaone.PaymentMethod.t()
Raising variant of set_default/3.
@spec setup(Nombaone.Client.t(), map(), keyword()) :: {:ok, Nombaone.CheckoutSetup.t()} | {:error, Nombaone.Error.t()}
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. Redirect them to the
returned checkout_link.
Money is integer kobo
amount_in_kobo (the validation charge) is integer kobo (₦1.00 = 100).
Example
{:ok, setup} =
Nombaone.PaymentMethods.setup(client, %{
customer_ref: customer.id,
amount_in_kobo: 5_000,
callback_url: "https://example.com/billing/return"
})
@spec setup!(Nombaone.Client.t(), map(), keyword()) :: Nombaone.CheckoutSetup.t()
Raising variant of setup/3.