Sandbox. No real money moves. API keys are stored in plain text.
FFeignPayDocs

API reference

FeignPay API reference

116 endpoints across 17 groups. Nothing here moves real money. API keys are stored in plain text so you can read them out of the database, so never point this sandbox at real credentials.

Quickstart#

Amounts are integers in minor units, so 250000 NGN is 2,500.00. Public keys read. Secret and restricted keys additionally need an HMAC-SHA256 of <timestamp>.<body> in the X-Feign-Signature header, with the timestamp within 15 minutes.

curl -X POST http://feignpaygate.craftsmanjohn.com/api/v1/payments \
  -H "X-Feign-Key: fpn_sk_test_..." \
  -H "X-Feign-Signature: t=1700000000,v1=$(...)" \
  -H "Content-Type: application/json" \
  -d '{"amount":250000,"currency":"NGN","scenario":"success"}'

GET /api/v1/scenarios is unauthenticated and lists every outcome the simulator can produce, so you can read that before you have a key.

Index#

MethodPathSummaryAuth
Service
GET / Landing page No credentials
GET /health Liveness probe No credentials
GET /api/v1 Service description No credentials
GET /api/v1/scenarios Scenario catalogue No credentials
Project and keys
GET /api/v1/project The project behind the presented key Public key
GET /api/v1/keys List API keys Public key
Payments
POST /api/v1/payments Create a payment Signed key
GET /api/v1/payments List payments Public key
GET /api/v1/payments/:id Retrieve a payment Public key
POST /api/v1/payments/:id/capture Capture an authorised payment Signed key
POST /api/v1/payments/:id/cancel Cancel a payment Signed key
GET /api/v1/payments/:id/refundable How much is left to refund Public key
Hosted checkout
POST /api/v1/checkout-sessions Create a checkout session Signed key
GET /api/v1/checkout-sessions/:id Retrieve a checkout session Public key
Refunds
POST /api/v1/refunds Create a refund Signed key
GET /api/v1/refunds List refunds Public key
GET /api/v1/refunds/:id Retrieve a refund Public key
POST /api/v1/refunds/:id/cancel Cancel a refund Signed key
Payouts and beneficiaries
POST /api/v1/beneficiaries Create a beneficiary Signed key
GET /api/v1/beneficiaries List beneficiaries Public key
POST /api/v1/payouts Create a payout Signed key
GET /api/v1/payouts List payouts Public key
GET /api/v1/payouts/:id Retrieve a payout Public key
POST /api/v1/payouts/:id/cancel Cancel a pending payout Signed key
POST /api/v1/payouts/:id/reverse Reverse a paid payout Signed key
GET /api/v1/balance Organisation balance Public key
Disputes
GET /api/v1/disputes/evidence-template Evidence types and an example Public key
POST /api/v1/disputes Open a dispute Signed key
GET /api/v1/disputes List disputes Public key
GET /api/v1/disputes/:id Retrieve a dispute Public key
POST /api/v1/disputes/:id/evidence Submit evidence Signed key
POST /api/v1/disputes/:id/resolve Resolve a dispute Signed key
POST /api/v1/disputes/:id/close Close a dispute unanswered Signed key
Transfers
POST /api/v1/transfers Create a transfer Signed key
GET /api/v1/transfers List transfers Public key
GET /api/v1/transfers/:id Retrieve a transfer Public key
POST /api/v1/transfers/:id/reverse Reverse a settled transfer Signed key
Customers
POST /api/v1/customers Create a customer Signed key
GET /api/v1/customers List customers Public key
GET /api/v1/customers/:id Retrieve a customer Public key
GET /api/v1/customers/:id/payments Payments for a customer Public key
PATCH /api/v1/customers/:id Update a customer Signed key
DELETE /api/v1/customers/:id Delete a customer Signed key
Payment methods
POST /api/v1/payment-methods Save a payment method Signed key
GET /api/v1/payment-methods List payment methods Public key
GET /api/v1/payment-methods/:id Retrieve a payment method Public key
POST /api/v1/payment-methods/:id/default Make a method the default Signed key
DELETE /api/v1/payment-methods/:id Detach a payment method Signed key
Plans and subscriptions
POST /api/v1/plans Create a plan Signed key
GET /api/v1/plans List plans Public key
GET /api/v1/plans/:id Retrieve a plan Public key
POST /api/v1/subscriptions Create a subscription Signed key
GET /api/v1/subscriptions List subscriptions Public key
GET /api/v1/subscriptions/:id Retrieve a subscription Public key
POST /api/v1/subscriptions/:id/cancel Cancel a subscription Signed key
POST /api/v1/subscriptions/:id/pause Pause a subscription Signed key
POST /api/v1/subscriptions/:id/resume Resume a paused subscription Signed key
POST /api/v1/subscriptions/:id/charge Charge now Signed key
GET /api/v1/billing-preview Preview the next billing date Public key
Wallets
POST /api/v1/wallets Create or fetch a wallet Signed key
GET /api/v1/wallets List wallets Public key
GET /api/v1/wallets/audit Recompute every balance Public key
GET /api/v1/wallets/:id Retrieve a wallet Public key
POST /api/v1/wallets/:id/credit Credit a wallet Signed key
POST /api/v1/wallets/:id/debit Debit a wallet Signed key
GET /api/v1/wallets/:id/transactions Wallet statement Public key
POST /api/v1/wallets/:id/status Change wallet status Signed key
Virtual accounts
POST /api/v1/virtual-accounts Create a virtual account Signed key
GET /api/v1/virtual-accounts List virtual accounts Public key
GET /api/v1/virtual-accounts/:id Retrieve a virtual account Public key
POST /api/v1/virtual-accounts/:id/fund Simulate an inbound transfer Signed key
POST /api/v1/virtual-accounts/:id/status Change account status Signed key
Webhooks
GET /api/v1/webhooks List events Public key
GET /api/v1/webhooks/:id Retrieve an event Public key
GET /api/v1/webhooks/:id/attempts Delivery attempts for an event Public key
POST /api/v1/webhooks/:id/replay Replay an event Signed key
POST /api/v1/webhooks/flush Deliver everything pending now Signed key
Hosted payment pages
GET /pay/:token Checkout page No credentials
POST /pay/:token Submit the checkout form No credentials
GET /pay/:token/3ds 3DS challenge No credentials
POST /pay/:token/3ds Submit the 3DS code No credentials
GET /pay/:token/3ds/enroll Device enrolment No credentials
POST /pay/:token/3ds/enroll Confirm device enrolment No credentials
GET /pay/:token/3ds/resend Resend the 3DS code No credentials
GET /pay/:token/transfer Bank transfer instructions No credentials
POST /pay/:token/transfer/confirm Confirm the bank transfer No credentials
GET /pay/:token/wallet Mobile money approval No credentials
POST /pay/:token/wallet/approve Approve the mobile money prompt No credentials
POST /pay/:token/wallet/decline Decline the mobile money prompt No credentials
GET /pay/:token/cancel Cancel page No credentials
POST /pay/:token/cancel Confirm cancellation No credentials
GET /pay/:token/result Result page No credentials
Sandbox console
GET /login Sign in to the console No credentials
POST /login Sign in to the console No credentials
GET /register Create an account No credentials
POST /register Create an account No credentials
POST /logout Sign out of the console Console account
GET /console Dashboard Console account
GET /console/scenarios Scenario launcher Console account
POST /console/scenarios Launch a payment Console account
GET /console/keys API keys, with copy controls and the signing recipe Console account
POST /console/keys/webhook Manage the project webhook URL and signing secret Console account
GET /console/requests Request log Console account
POST /console/requests/replay Replay a logged request Console account
GET /console/webhooks Webhook log Console account
POST /console/webhooks/replay Replay an event from the console Console account
POST /console/webhooks/flush Flush this project’s pending events Console account
GET /console/organizations List your organizations Console account
GET /console/organizations/new New organization form Console account
POST /console/organizations/new Create an organization Console account
GET /console/organizations/:slug Configure an organization Console account
POST /console/organizations/:slug Save an organization Console account
GET /console/get-started First run, no organizations yet Console account
GET /console/account Account and its scope Console account
GET /console/objects Object browser Console account
Docs
GET /docs API reference No credentials

Service#

Unauthenticated entry points. Useful for a health check and for discovering the base URLs, without needing a key.

GET / #

Landing page

The HTML landing page. Counts and test data on it are read from the database and the catalogue rather than written into the markup, so the numbers cannot drift.

No credentials Returns landing_page

GET /health #

Liveness probe

Returns immediately. Does not touch the database, so a healthy response does not prove the schema is applied.

No credentials Returns health

GET /api/v1 #

Service description

Points at the API base, the docs page, and the console. This is what the root returned before the root became the landing page, moved here so a client following api_base lands on something machine readable.

No credentials Returns service

GET /api/v1/scenarios #

Scenario catalogue

Every outcome the scenario engine can produce, the magic reference prefixes and card numbers that trigger them, and the built in test cards. Unauthenticated on purpose so an integration can read it before it has a key.

No credentials Returns scenario_catalogue

Project and keys#

What the sandbox knows about itself, and which credentials exist.

GET /api/v1/project #

The project behind the presented key

Resolves the project from the key, so this is the cheapest way to check that a key and its signature are correct. Also the cheapest way to see which capabilities and currencies the organization behind a key is configured for.

Public key Returns project

GET /api/v1/keys #

List API keys

Returns every key for the project including the secret values. They are stored in plain text on purpose so they are easy to read out of the database while testing.

Public key Returns api_key

Notes
  • Do not point this sandbox at real credentials.

Payments#

Create and inspect payments. The outcome of a payment is decided by the scenario engine, not by the amount or the card.

POST /api/v1/payments #

Create a payment

Creates a payment and immediately resolves it through the scenario engine. Depending on the scenario this can settle synchronously, stop at requires_action, or hand back to the scheduler.

Signed key Returns payment

Request body
Request body fields
NameTypeNotes
amount* integer Amount in minor units. 250000 NGN is 2,500.00. Must be at least 1.
currency* string ISO 4217 code. The exponent is read from the code rather than assumed, so JPY is 0 decimals and KWD is 3.
instrument string How the payer intends to pay. one of card</code>, <code>bank_account</code>, <code>wallet</code>, <code>ussd default card
reference string Your own identifier. A magic prefix here can force the outcome, see the scenario catalogue.
description string Shown to the payer on the hosted page.
redirect_url string Where the payer lands after a successful checkout. Must be http or https.
failure_url string Where the payer lands after a failure.
cancel_url string Where the payer lands if they abandon the payment.
webhook_url string Where events for this payment are delivered. Falls back to the project URL.
metadata object Free form object, returned verbatim. Must be an object, not an array.
scenario string Force the outcome. Highest precedence in the scenario engine. one of success</code>, <code>failure</code>, <code>3ds</code>, <code>pending</code>, <code>3ds_then_failure
number string Card number, digits only. Never stored: only brand, last four, BIN, and expiry are kept.
exp_month integer Card expiry month, 1 to 12.
exp_year integer Card expiry year, between 2024 and 2040.
customer string A customer public id to attach the payment to.
payment_method string A saved payment method public id. Mutually exclusive with number, exp_month, and exp_year.
capture_method string Manual leaves the payment at requires_confirmation until you capture it. one of automatic</code>, <code>manual default automatic
three_ds boolean Force a 3DS challenge regardless of the card.
Notes
  • Sending both payment_method and card details is refused rather than resolved, because two sources for the instrument is ambiguous.
  • A saved method already belongs to a customer, so customer must not be sent alongside it.
Also returns

GET /api/v1/payments #

List payments

Public key Returns payment

Query parameters
Query parameters
NameTypeNotes
status string Filter by payment status.
customer string Only payments for this customer public id.
limit integer How many records to return. default 20 between 1 and 100
cursor integer Return records after this internal id. Omit for the first page. minimum 1

GET /api/v1/payments/:id #

Retrieve a payment

Public key Returns payment

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the payment, for example pay_a1b2c3d4.
Also returns

POST /api/v1/payments/:id/capture #

Capture an authorised payment

Only meaningful when capture_method is manual. Moves requires_confirmation to succeeded.

Signed key Returns payment

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the payment, for example pay_a1b2c3d4.

POST /api/v1/payments/:id/cancel #

Cancel a payment

Refused once the payment has reached a state that money was taken in.

Signed key Returns payment

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the payment, for example pay_a1b2c3d4.

GET /api/v1/payments/:id/refundable #

How much is left to refund

Accounts for refunds already created, including ones still in flight, so two concurrent refunds cannot over refund.

Public key Returns refundable

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the payment, for example pay_a1b2c3d4.
Also returns

Hosted checkout#

A checkout session turns a payment into a hosted page the payer can be redirected to. This is the path an integration should test against, since it exercises the same redirect handling a real provider has.

POST /api/v1/checkout-sessions #

Create a checkout session

Creates the payment first, then the session that decides how the hosted page behaves. Refused if the payment resolved immediately, since there would be nothing to check out.

Signed key Returns checkout_session

Request body
Request body fields
NameTypeNotes
amount* integer Amount in minor units. At least 1.
currency* string ISO 4217 code.
instrument string Which hosted form to show. one of card</code>, <code>bank_account</code>, <code>wallet</code>, <code>ussd default card
reference string Your identifier. Magic prefixes apply here too.
description string Shown to the payer.
redirect_url* string Where the payer is sent when the checkout finishes, with status, payment_id and reference in the query. Absolute http or https.
failure_url string Landing page after failure. Falls back to redirect_url.
cancel_url string Landing page if the payer cancels or the session expires. Falls back to redirect_url.
webhook_url string Delivery target for this payment, falling back to the project URL.
metadata object Free form object, returned verbatim.
scenario string Force the outcome. one of success</code>, <code>failure</code>, <code>3ds</code>, <code>pending</code>, <code>3ds_then_failure
customer string Customer public id.
capture_method string Manual leaves the payment awaiting capture after the hosted flow. one of automatic</code>, <code>manual default automatic
three_ds_enrolment boolean After the correct code, ask the payer to enrol the device as a second step. default false
Also returns

GET /api/v1/checkout-sessions/:id #

Retrieve a checkout session

Reports expired rather than gone once the session has passed its expiry, so a late return can be told apart from a bad id.

Public key Returns checkout_session

Path parameters
Path parameters
NameTypeNotes
id* string The session token, which is also the path segment on the hosted pages.
Also returns

Refunds#

Full and partial refunds, in flight or settled.

POST /api/v1/refunds #

Create a refund

Reserves the amount against the payment immediately, so two concurrent refunds cannot together exceed what is refundable.

Signed key Returns refund

Request body
Request body fields
NameTypeNotes
payment* string Payment public id to refund.
amount* integer Amount in minor units. Omit for a full refund of everything still refundable.
reason* string Why the money is going back. one of duplicate</code>, <code>fraudulent</code>, <code>requested_by_customer</code>, <code>expired_uncaptured_charge
note string Internal note, not shown to the payer.
metadata object Free form object, returned verbatim.
scenario string Force the outcome. Useful for testing your failure handling.
Notes
  • A fraudulent refund keeps the fee. The others return the full amount.

GET /api/v1/refunds #

List refunds

Public key Returns refund

Query parameters
Query parameters
NameTypeNotes
payment string Only refunds for this payment public id.
status string Filter by refund status.
limit integer How many records to return. default 20 between 1 and 100
cursor integer Return records after this internal id. Omit for the first page. minimum 1

GET /api/v1/refunds/:id #

Retrieve a refund

Includes a payment_object with the id and status, so a refund can be read without a second call.

Public key Returns refund

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the refund, for example pay_a1b2c3d4.
Also returns

POST /api/v1/refunds/:id/cancel #

Cancel a refund

Only while the refund is still pending. Cancelling releases the reserved amount back to the payment.

Signed key Returns refund

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the refund, for example pay_a1b2c3d4.

Payouts and beneficiaries#

Money out. Payouts settle through the scheduler unless cancelled in time.

POST /api/v1/beneficiaries #

Create a beneficiary

Sandbox beneficiaries are verified immediately, so there is no separate verification step to wait for.

Signed key Returns payout_beneficiary

Request body
Request body fields
NameTypeNotes
type* string What kind of destination this is. one of bank_account</code>, <code>card</code>, <code>wallet
account_name* string Name on the account.
account_number string Required for bank_account. Exactly 10 digits.
bank_code string Required for bank_account.
bank_name string Display name for the bank.
currency string Restrict this beneficiary to one currency.
wallet_code string Required for wallet, for example mtn.
wallet_number string Required for wallet.
card_last4 string Required for card.
card_brand string Card brand, for display.
is_default boolean Make this the project default. Clears the previous default. default false
Notes
  • Type specific fields are validated together, so a bank_account with no bank_code is refused rather than stored half filled.

GET /api/v1/beneficiaries #

List beneficiaries

Public key Returns payout_beneficiary

POST /api/v1/payouts #

Create a payout

Starts as pending and is advanced by the scheduler, so the intermediate processing state is observable.

Signed key Returns payout

Request body
Request body fields
NameTypeNotes
amount* integer Amount in minor units. At least 1.
currency* string ISO 4217 code.
beneficiary string Beneficiary public id. Falls back to the project default.
reason string Why the money is leaving.
reference string Your identifier.
webhook_url string Delivery target for this payout, falling back to the project URL.
metadata object Free form object, returned verbatim.
scenario string Force the outcome, for example failure.
Also returns

GET /api/v1/payouts #

List payouts

Public key Returns payout

Query parameters
Query parameters
NameTypeNotes
status string Filter by payout status.
limit integer How many records to return. default 20 between 1 and 100
cursor integer Return records after this internal id. Omit for the first page. minimum 1

GET /api/v1/payouts/:id #

Retrieve a payout

Public key Returns payout

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the payout, for example pay_a1b2c3d4.
Also returns

POST /api/v1/payouts/:id/cancel #

Cancel a pending payout

Signed key Returns payout

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the payout, for example pay_a1b2c3d4.

POST /api/v1/payouts/:id/reverse #

Reverse a paid payout

Credits the ledger back and creates a linked payout. A second reversal of the same payout is refused.

Signed key Returns payout

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the payout, for example pay_a1b2c3d4.
Also returns

GET /api/v1/balance #

Organisation balance

Summed from the ledger, grouped by currency. Every entry continues the previous running balance.

Public key Returns balance

Disputes#

A cardholder disputes a payment. Both resolution branches are reachable without waiting for a review window.

GET /api/v1/disputes/evidence-template #

Evidence types and an example

The accepted evidence types, and a well formed entry to copy.

Public key Returns evidence_template

POST /api/v1/disputes #

Open a dispute

Signed key Returns dispute

Request body
Request body fields
NameTypeNotes
payment* string Payment public id being disputed.
reason* string Network reason code. one of fraudulent</code>, <code>unrecognized</code>, <code>duplicate</code>, <code>product_not_received</code>, <code>product_unacceptable</code>, <code>subscription_cancelled</code>, <code>other
reason_text string Free text from the cardholder.
amount integer Disputed amount in minor units. Defaults to the full payment amount.
Also returns

GET /api/v1/disputes #

List disputes

Public key Returns dispute

Query parameters
Query parameters
NameTypeNotes
status string Filter by dispute status.
limit integer How many records to return. default 20 between 1 and 100
cursor integer Return records after this internal id. Omit for the first page. minimum 1

GET /api/v1/disputes/:id #

Retrieve a dispute

Public key Returns dispute

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the dispute, for example pay_a1b2c3d4.
Also returns

POST /api/v1/disputes/:id/evidence #

Submit evidence

Every entry is validated: type is required, text and url must be strings.

Signed key Returns dispute

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the dispute, for example pay_a1b2c3d4.
Request body
Request body fields
NameTypeNotes
evidence* array Array of objects. Each needs a type from the evidence template, and may carry text and url.
Also returns

POST /api/v1/disputes/:id/resolve #

Resolve a dispute

Resolves immediately in either direction, so both of your handlers can be exercised without waiting for a review.

Signed key Returns dispute

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the dispute, for example pay_a1b2c3d4.
Request body
Request body fields
NameTypeNotes
outcome* string Which way the network rules. one of won</code>, <code>lost
fee_percent integer Dispute fee to apply on a loss, as a percentage. Defaults to the project fee.
Also returns

POST /api/v1/disputes/:id/close #

Close a dispute unanswered

Close a dispute you decide not to answer. The payment status is restored.

Signed key Returns dispute

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the dispute, for example pay_a1b2c3d4.

Transfers#

Move money between objects inside the sandbox. Settles through the scheduler and is reversible.

POST /api/v1/transfers #

Create a transfer

Signed key Returns transfer

Request body
Request body fields
NameTypeNotes
amount* integer Amount in minor units. At least 1.
currency* string ISO 4217 code.
payout string Payout public id to transfer to.
payment string Payment public id to transfer from.
destination object Free form destination details, stored verbatim.
reference string Your identifier.
metadata object Free form object, returned verbatim.
scenario string Force the outcome.

GET /api/v1/transfers #

List transfers

Public key Returns transfer

Query parameters
Query parameters
NameTypeNotes
status string Filter by transfer status.
limit integer How many records to return. default 20 between 1 and 100
cursor integer Return records after this internal id. Omit for the first page. minimum 1

GET /api/v1/transfers/:id #

Retrieve a transfer

Related payment, payout, and reversal are returned as public ids, so no follow up call is needed to follow a link.

Public key Returns transfer

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the transfer, for example pay_a1b2c3d4.
Also returns

POST /api/v1/transfers/:id/reverse #

Reverse a settled transfer

Signed key Returns transfer

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the transfer, for example pay_a1b2c3d4.
Also returns

Customers#

The payer record. Everything else hangs off a customer.

POST /api/v1/customers #

Create a customer

Signed key Returns customer

Request body
Request body fields
NameTypeNotes
email string Must be unique within the project.
name string Full name.
phone string Phone number, used for USSD and mobile money.
country string Two letter country code. default NG
default_currency string ISO 4217 code used when a payment omits one.
metadata object Free form object, returned verbatim.
Also returns

GET /api/v1/customers #

List customers

Public key Returns customer

Query parameters
Query parameters
NameTypeNotes
email string Filter by email.
limit integer How many records to return. default 20 between 1 and 100
cursor integer Return records after this internal id. Omit for the first page. minimum 1

GET /api/v1/customers/:id #

Retrieve a customer

Public key Returns customer

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the customer, for example pay_a1b2c3d4.
Also returns

GET /api/v1/customers/:id/payments #

Payments for a customer

Public key Returns payment

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the customer, for example pay_a1b2c3d4.
Query parameters
Query parameters
NameTypeNotes
limit integer How many payments to return. default 20 between 1 and 100
Also returns

PATCH /api/v1/customers/:id #

Update a customer

Only the fields you send are changed. Email and country are immutable here.

Signed key Returns customer

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the customer, for example pay_a1b2c3d4.
Request body
Request body fields
NameTypeNotes
name string New full name.
phone string New phone number.
default_currency string Validated as a known ISO 4217 code.
metadata object Replaces the stored metadata.
Also returns

DELETE /api/v1/customers/:id #

Delete a customer

Refused while the customer has payments, since deleting would orphan them.

Signed key Returns customer_deleted

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the customer, for example pay_a1b2c3d4.
Also returns

Payment methods#

Saved instruments, reusable on a charge. Only a token is stored, never a card number.

POST /api/v1/payment-methods #

Save a payment method

Signed key Returns payment_method

Request body
Request body fields
NameTypeNotes
type* string What kind of instrument this is. one of card</code>, <code>bank_account</code>, <code>wallet</code>, <code>ussd
customer* string Customer public id that owns it.
display_name string Label shown to you in a list.
number string Card number. Required for type card. Never stored, only brand, last four, BIN, and expiry.
exp_month integer Card expiry month. Required for type card.
exp_year integer Card expiry year, 2024 to 2040. Required for type card.
bank_code string Required for bank_account and ussd.
bank_name string Display name for the bank.
account_number string Required for bank_account. Only the last four are kept.
wallet_code string Required for wallet.
wallet_number string Required for wallet.
is_default boolean Make this the customer default. default false
metadata object Free form object, returned verbatim.

GET /api/v1/payment-methods #

List payment methods

Public key Returns payment_method

Query parameters
Query parameters
NameTypeNotes
customer* string Customer public id. Required, since the list is scoped to one customer.

GET /api/v1/payment-methods/:id #

Retrieve a payment method

Public key Returns payment_method

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the payment method, for example pay_a1b2c3d4.
Also returns

POST /api/v1/payment-methods/:id/default #

Make a method the default

Clears the previous default for that customer.

Signed key Returns payment_method

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the payment method, for example pay_a1b2c3d4.
Also returns

DELETE /api/v1/payment-methods/:id #

Detach a payment method

Refused while a payment is in flight that uses it, so an in progress charge is never left without an instrument.

Signed key Returns payment_method_detached

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the payment method, for example pay_a1b2c3d4.
Also returns

Plans and subscriptions#

Recurring billing with a dunning schedule, so the unpaid path is reachable without waiting.

POST /api/v1/plans #

Create a plan

Signed key Returns plan

Request body
Request body fields
NameTypeNotes
name* string Plan name.
amount* integer Amount in minor units per interval. At least 1.
currency* string ISO 4217 code.
interval* string Billing period unit. one of day</code>, <code>week</code>, <code>month</code>, <code>year
interval_count integer How many intervals make one period. 3 with month bills quarterly. default 1
trial_days integer Days before the first charge. default 0
description string Free text.
metadata object Free form object, returned verbatim.
Notes
  • Month arithmetic clamps to the last day of the target month, so 31 January plus one month is 28 or 29 February, not 3 March.

GET /api/v1/plans #

List plans

Public key Returns plan

Query parameters
Query parameters
NameTypeNotes
limit integer How many plans to return. default 20 between 1 and 100

GET /api/v1/plans/:id #

Retrieve a plan

Public key Returns plan

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the plan, for example pay_a1b2c3d4.
Also returns

POST /api/v1/subscriptions #

Create a subscription

Signed key Returns subscription

Request body
Request body fields
NameTypeNotes
plan* string Plan public id.
customer* string Customer public id.
reference string Your identifier.
metadata object Free form object, returned verbatim.
scenario string Force the outcome of each charge.

GET /api/v1/subscriptions #

List subscriptions

Public key Returns subscription

Query parameters
Query parameters
NameTypeNotes
status string Filter by subscription status.
customer string Only subscriptions for this customer public id.
limit integer How many subscriptions to return. default 20 between 1 and 100

GET /api/v1/subscriptions/:id #

Retrieve a subscription

Public key Returns subscription

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the subscription, for example pay_a1b2c3d4.
Also returns

POST /api/v1/subscriptions/:id/cancel #

Cancel a subscription

Immediate by default. Send at_period_end true to keep access until the period closes.

Signed key Returns subscription

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the subscription, for example pay_a1b2c3d4.
Request body
Request body fields
NameTypeNotes
at_period_end boolean Cancel at the end of the paid period rather than now. default false

POST /api/v1/subscriptions/:id/pause #

Pause a subscription

Signed key Returns subscription

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the subscription, for example pay_a1b2c3d4.

POST /api/v1/subscriptions/:id/resume #

Resume a paused subscription

Signed key Returns subscription

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the subscription, for example pay_a1b2c3d4.
Also returns

POST /api/v1/subscriptions/:id/charge #

Charge now

Runs a renewal immediately instead of waiting for the scheduler, so the charge path is testable on demand.

Signed key Returns subscription

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the subscription, for example pay_a1b2c3d4.
Also returns

GET /api/v1/billing-preview #

Preview the next billing date

Applies the same interval arithmetic the scheduler uses, so a date your integration computes can be checked against the one the sandbox will actually use.

Public key Returns billing_preview

Query parameters
Query parameters
NameTypeNotes
interval* string Billing period unit. one of day</code>, <code>week</code>, <code>month</code>, <code>year
count integer How many intervals to add. default 1 between 1 and 24
from string ISO date or datetime to add to. Defaults to now.
Notes
  • Month arithmetic clamps to the last day of the target month.

Wallets#

Stored value. A debit that would overdraw is refused, never allowed to go negative.

POST /api/v1/wallets #

Create or fetch a wallet

Idempotent per customer and currency: calling it twice returns the same wallet.

Signed key Returns wallet

Request body
Request body fields
NameTypeNotes
currency* string ISO 4217 code. One wallet per customer per currency.
customer* string Customer public id.
Also returns

GET /api/v1/wallets #

List wallets

Public key Returns wallet

Query parameters
Query parameters
NameTypeNotes
customer string Only wallets for this customer public id.
limit integer How many wallets to return. default 20 between 1 and 100

GET /api/v1/wallets/audit #

Recompute every balance

Recalculates each wallet balance from its own statement and reports any that disagree with the stored value. A useful assertion at the end of a money movement test.

Public key Returns wallet_audit

GET /api/v1/wallets/:id #

Retrieve a wallet

Public key Returns wallet

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the wallet, for example pay_a1b2c3d4.
Also returns

POST /api/v1/wallets/:id/credit #

Credit a wallet

Signed key Returns wallet_transaction

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the wallet, for example pay_a1b2c3d4.
Request body
Request body fields
NameTypeNotes
amount* integer Amount in minor units. At least 1.
description string Shown on the statement.
metadata object Free form object, returned verbatim.

POST /api/v1/wallets/:id/debit #

Debit a wallet

Refused rather than allowed to overdraw. The balance update is compare and set against the previous value, so two concurrent debits cannot both succeed.

Signed key Returns wallet_transaction

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the wallet, for example pay_a1b2c3d4.
Request body
Request body fields
NameTypeNotes
amount* integer Amount in minor units. At least 1, and no more than the balance.
description string Shown on the statement.
metadata object Free form object, returned verbatim.

GET /api/v1/wallets/:id/transactions #

Wallet statement

Each entry carries balance_after, so the running balance can be walked forward.

Public key Returns wallet_transaction

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the wallet, for example pay_a1b2c3d4.
Query parameters
Query parameters
NameTypeNotes
limit integer How many records to return. default 20 between 1 and 100
cursor integer Return records after this internal id. Omit for the first page. minimum 1
Also returns

POST /api/v1/wallets/:id/status #

Change wallet status

A frozen wallet refuses both credits and debits. A closed one is terminal.

Signed key Returns wallet

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the wallet, for example pay_a1b2c3d4.
Request body
Request body fields
NameTypeNotes
status* string The new status. one of active</code>, <code>frozen</code>, <code>closed
Also returns

Virtual accounts#

A unique account number per customer. Funding it credits the linked wallet.

POST /api/v1/virtual-accounts #

Create a virtual account

Allocates a number prefixed 999, which is reserved for sandbox use.

Signed key Returns virtual_account

Request body
Request body fields
NameTypeNotes
currency* string ISO 4217 code for the account.
customer* string Customer public id.
metadata object Free form object, returned verbatim.
Also returns

GET /api/v1/virtual-accounts #

List virtual accounts

Public key Returns virtual_account

Query parameters
Query parameters
NameTypeNotes
customer string Only accounts for this customer public id.
limit integer How many accounts to return. default 20 between 1 and 100

GET /api/v1/virtual-accounts/:id #

Retrieve a virtual account

Public key Returns virtual_account

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the virtual account, for example pay_a1b2c3d4.

POST /api/v1/virtual-accounts/:id/fund #

Simulate an inbound transfer

Credits the linked wallet and records the funding, which is how you test a deposit flow end to end.

Signed key Returns virtual_account_funding

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the virtual account, for example pay_a1b2c3d4.
Request body
Request body fields
NameTypeNotes
amount* integer Amount in minor units. At least 1.
sender_name string Who sent it, recorded on the funding event.
reference string Your reference for the inbound transfer.

POST /api/v1/virtual-accounts/:id/status #

Change account status

Signed key Returns virtual_account

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the virtual account, for example pay_a1b2c3d4.
Request body
Request body fields
NameTypeNotes
status* string The new status. one of active</code>, <code>frozen</code>, <code>closed

Webhooks#

Events are delivered over real HTTP with an HMAC signature and retried on a backoff. These endpoints let you inspect and replay what was sent.

GET /api/v1/webhooks #

List events

Public key Returns event

Query parameters
Query parameters
NameTypeNotes
type string Filter by event type, for example payment.succeeded.
status string Filter by delivery state. one of pending</code>, <code>delivering</code>, <code>delivered</code>, <code>failed</code>, <code>abandoned</code>, <code>skipped
limit integer How many events to return. default 20 between 1 and 100
Notes
  • An unknown status is refused with the accepted list rather than being ignored.

GET /api/v1/webhooks/:id #

Retrieve an event

Includes the exact payload that was sent, under data.

Public key Returns event

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the webhook event, for example pay_a1b2c3d4.
Also returns

GET /api/v1/webhooks/:id/attempts #

Delivery attempts for an event

Every attempt with its status code, duration, and the response body your receiver returned.

Public key Returns webhook_attempt

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the webhook event, for example pay_a1b2c3d4.
Also returns

POST /api/v1/webhooks/:id/replay #

Replay an event

Creates a fresh event with the same payload and queues it for immediate delivery.

Signed key Returns replay

Path parameters
Path parameters
NameTypeNotes
id* string Public id of the webhook event, for example pay_a1b2c3d4.
Also returns

POST /api/v1/webhooks/flush #

Deliver everything pending now

Runs a delivery pass immediately rather than waiting for the next scheduler tick. Returns how many events were delivered.

Signed key Returns result

Hosted payment pages#

What the payer sees. These are plain HTML forms, so they are driven by a browser rather than by JSON, and they carry no API key because the payer does not have one.

GET /pay/:token #

Checkout page

Card, bank transfer, and mobile money forms, with the test cards, test mobile money numbers, and a test bank account listed on the page. A click on a test row fills the form. A payment that is no longer payable redirects to the result page rather than offering a fresh form.

No credentials Returns checkout_page

Path parameters
Path parameters
NameTypeNotes
token* string The checkout session token.

POST /pay/:token #

Submit the checkout form

Redirects to the 3DS challenge or to the result page. Invalid input re-renders the form with messages and a 422.

No credentials Returns checkout_page

Path parameters
Path parameters
NameTypeNotes
token* string The checkout session token.

GET /pay/:token/3ds #

3DS challenge

The OTP is 123456. Send any other code to test your failure path. A completed challenge redirects to the result page.

No credentials Returns challenge_page

Path parameters
Path parameters
NameTypeNotes
token* string The checkout session token.
Also returns

POST /pay/:token/3ds #

Submit the 3DS code

After the correct code, either completes or offers device enrolment when the session asked for it.

No credentials Returns challenge_page

Path parameters
Path parameters
NameTypeNotes
token* string The checkout session token.
Notes
  • Attempts are limited, so the retry path is reachable.
Also returns

GET /pay/:token/3ds/enroll #

Device enrolment

Only shown when the session was created with three_ds_enrolment.

No credentials Returns enrolment_page

Path parameters
Path parameters
NameTypeNotes
token* string The checkout session token.

POST /pay/:token/3ds/enroll #

Confirm device enrolment

No credentials Returns enrolment_page

Path parameters
Path parameters
NameTypeNotes
token* string The checkout session token.

GET /pay/:token/3ds/resend #

Resend the 3DS code

Simulated resend. Does not reset the attempt counter, so it cannot be used to bypass the limit.

No credentials Returns challenge_page

Path parameters
Path parameters
NameTypeNotes
token* string The checkout session token.

GET /pay/:token/transfer #

Bank transfer instructions

Shows the simulated account details to transfer to, then waits for confirmation.

No credentials Returns transfer_page

Path parameters
Path parameters
NameTypeNotes
token* string The checkout session token.

POST /pay/:token/transfer/confirm #

Confirm the bank transfer

Moves the payment to succeeded, as though the money had arrived.

No credentials Returns transfer_page

Path parameters
Path parameters
NameTypeNotes
token* string The checkout session token.

GET /pay/:token/wallet #

Mobile money approval

Simulates the push notification prompt. The code and number come from the query string, which is what a real wallet redirect does.

No credentials Returns wallet_page

Path parameters
Path parameters
NameTypeNotes
token* string The checkout session token.

POST /pay/:token/wallet/approve #

Approve the mobile money prompt

No credentials Returns wallet_page

Path parameters
Path parameters
NameTypeNotes
token* string The checkout session token.

POST /pay/:token/wallet/decline #

Decline the mobile money prompt

No credentials Returns wallet_page

Path parameters
Path parameters
NameTypeNotes
token* string The checkout session token.

GET /pay/:token/cancel #

Cancel page

Asks the payer to confirm before abandoning the payment.

No credentials Returns cancel_page

Path parameters
Path parameters
NameTypeNotes
token* string The checkout session token.

POST /pay/:token/cancel #

Confirm cancellation

Cancels the payment, then redirects to cancel_url or to the result page.

No credentials Returns cancel_page

Path parameters
Path parameters
NameTypeNotes
token* string The checkout session token.
Also returns

GET /pay/:token/result #

Result page

Shows the outcome, including the decline code when the payment failed, and redirects back to the merchant after a short delay.

No credentials Returns result_page

Path parameters
Path parameters
NameTypeNotes
token* string The checkout session token.

Sandbox console#

A browser view of the sandbox state at /console, behind a console account. The account decides which organizations you see: every read is scoped to the organizations you are a member of, so a slug belonging to another account is a 404 rather than someone else’s data. The JSON API is unaffected and still authenticates with API keys.

GET /login #

Sign in to the console

Form encoded. Starts a session cookie and continues to ?next=, or the dashboard. A wrong password and an unknown address give the same message, so the form is not an oracle for which addresses have accounts.

No credentials Returns auth_page

POST /login #

Sign in to the console

Validates the credentials and sets the session cookie. Not rate limited, deliberately: this is a sandbox.

No credentials Returns redirect

GET /register #

Create an account

A new account starts with no organizations, which is the honest state. Create one from the console and it belongs to that account alone.

No credentials Returns auth_page

POST /register #

Create an account

Stores the password as a scrypt hash and signs the new account straight in. Hashed rather than plain text, unlike api_keys.secret, because a console password is a credential a person reuses elsewhere.

No credentials Returns redirect

POST /logout #

Sign out of the console

Deletes the session row and clears the cookie.

Console account Returns redirect

GET /console #

Dashboard

Balances, object counts, and recent activity for the selected organization. Takes ?org= and ?env=. A ?org= naming an organization you do not belong to is a 404, so the selection cannot be widened by editing the URL.

Console account Returns console_page

GET /console/scenarios #

Scenario launcher

Force any outcome as a button, without writing a request. Also lists the magic references and cards.

Console account Returns console_page

POST /console/scenarios #

Launch a payment

Form encoded. Creates a real payment through the same code path the API uses.

Console account Returns console_page

GET /console/keys #

API keys, with copy controls and the signing recipe

Every key in plain text with a copy control, plus the signing recipe.

Console account Returns console_page

POST /console/keys/webhook #

Manage the project webhook URL and signing secret

intent=save_url stores webhook_url (absolute http or https) and generates a whsec_ signing secret if none exists. intent=remove_url clears the URL, so new events are skipped. intent=generate_secret creates or replaces the secret. intent=revoke_secret clears it, so deliveries are refused. Scoped to the selected project.

Console account Returns console_page

GET /console/requests #

Request log

Every API call against the selected project, plus your own console page views. Filter by ?status=2xx, 4xx, or 5xx. Full request and response bodies are stored, with credentials redacted.

Console account Returns console_page

POST /console/requests/replay #

Replay a logged request

Explains that the log stores keys redacted, so a replay needs your own key.

Console account Returns console_page

GET /console/webhooks #

Webhook log

Every event with its payload and per attempt detail. Filter by ?status=.

Console account Returns console_page

POST /console/webhooks/replay #

Replay an event from the console

Console account Returns console_page

POST /console/webhooks/flush #

Flush this project’s pending events

Delivers only the selected project’s queued events. Scoped deliberately: the scheduler’s dispatcher is global, and reusing it here would let one account deliver another account’s webhooks.

Console account Returns console_page

GET /console/organizations #

List your organizations

Every organization you are a member of, with its country, default currency, and project count. Scoped to the signed-in account, so another account’s organizations are not listed here. The sidebar picker opens from this list.

Console account Returns console_page

GET /console/organizations/new #

New organization form

Capabilities default to all on and currencies to a small useful set. Submitting creates the organization, a test and a live project, and six keys.

Console account Returns console_page

POST /console/organizations/new #

Create an organization

Form encoded, with repeated capability and currency fields. Refuses a duplicate slug, and refuses a default currency that is not in the allowed list. The signed-in account becomes the owner, so the new organization is visible to them and to nobody else.

Console account Returns console_page

Also returns

GET /console/organizations/:slug #

Configure an organization

Capabilities, allowed currencies, projects, and their keys. Takes ?env= to keep the sidebar environment selection. A slug you are not a member of is a 404, not a 403, so it cannot be used to discover which organizations exist.

Console account Returns console_page

Path parameters
Path parameters
NameTypeNotes
slug* string Organization slug.
Also returns

POST /console/organizations/:slug #

Save an organization

Writes the capability set and currency allow-list. Refuses to leave the default currency outside the allow-list.

Console account Returns console_page

Path parameters
Path parameters
NameTypeNotes
slug* string Organization slug.
Also returns

GET /console/get-started #

First run, no organizations yet

Shown when a signed-in account owns nothing, so the empty console reads as an invitation rather than a failed page. Redirects to the dashboard once an organization exists.

Console account Returns console_page

GET /console/account #

Account and its scope

Who is signed in, and exactly which organizations this account can reach. Read-only for identity: changing an email or password needs a verification step this sandbox has no honest way to provide.

Console account Returns console_page

GET /console/objects #

Object browser

Browse payments, payouts, refunds, disputes, subscriptions, wallets, and customers with the stored record for each.

Console account Returns console_page

Query parameters
Query parameters
NameTypeNotes
kind string Which resource to browse. one of payments</code>, <code>payouts</code>, <code>refunds</code>, <code>disputes</code>, <code>subscriptions</code>, <code>wallets</code>, <code>customers default payments

Docs#

This reference. Rendered from the catalogue in src/docs/catalogue.ts, which tests/docs.test.ts checks against the registered route table, so it cannot describe an endpoint that does not exist.

GET /docs #

API reference

The catalogue you are reading, rendered from the same data the Markdown export is generated from.

No credentials Returns docs_page

Errors#

Every error has the same shape. Branch on error.code, which is stable; error.message is prose and may be reworded.

{
  "error": {
    "type": "invalid_request_error",
    "code": "parameter_missing",
    "message": "Missing required field: amount",
    "decline_code": null,
    "param": "amount",
    "doc_url": null,
    "meta": null
  }
}
Authentication and protocol errors, on every endpoint
StatusTypeCodeMeaning
400 invalid_request_error parameter_missing A required field was absent.
400 invalid_request_error parameter_invalid A field was present but the wrong shape, type, or outside its allowed range.
400 invalid_request_error malformed_body The body was not a JSON object.
400 invalid_request_error payload_too_large The body exceeded 2 MB.
401 authentication_error api_key_missing No key was presented.
401 authentication_error api_key_invalid The key does not exist in this project.
401 authentication_error api_key_revoked The key was revoked.
401 authentication_error api_key_expired The key passed its expiry.
401 authentication_error signature_missing A secret or restricted key was used without a signature header.
401 authentication_error signature_malformed The signature header was not t=<timestamp>,v1=<hex>.
401 authentication_error signature_invalid The HMAC did not match the timestamp and body.
401 authentication_error signature_expired The timestamp was more than 15 minutes from now.
403 permission_error forbidden The key is not allowed to do this.
404 invalid_request_error route_not_found No route matches the path.
404 invalid_request_error method_not_allowed The path exists under a different method.
409 invalid_request_error idempotency_key_conflict The idempotency key was reused with a different body.
409 invalid_request_error conflict The resource is not in a state that allows this.
422 invalid_request_error unprocessable The request was well formed but cannot be carried out.
500 api_error internal_error Something failed unexpectedly. The request id appears in the log.
Resource errors

The resource does not exist, or it is not in a state that allows what was asked. These are the codes worth branching on: a 409 almost always means the state changed underneath you, and a retry will not help.

StatusCodeMeaning
403 api_key_scope The key is valid but its scopes do not cover this endpoint.
400 csrf_token_missing A console form was submitted without its security token.
400 csrf_token_invalid A console form carried a security token that does not match the session, so it did not come from this console.
404 beneficiary_missing No beneficiary with that id in this project.
404 customer_missing No customer with that id in this project.
404 dispute_missing No dispute with that id in this project.
404 event_missing No webhook event with that id in this project.
404 payment_method_missing No payment method with that id in this project.
404 payment_missing No payment with that id in this project.
404 payout_missing No payout with that id in this project.
404 plan_missing No plan with that id in this project.
404 project_missing The project behind the key no longer exists.
404 refund_missing No refund with that id in this project.
404 session_missing No checkout session with that token.
404 subscription_missing No subscription with that id in this project.
404 transfer_missing No transfer with that id in this project.
404 virtual_account_missing No virtual account with that id in this project.
404 wallet_missing No wallet with that id in this project.
403 capability_disabled The organization is not enabled for this capability. Turn it on in the console under Organizations.
409 organization_exists Another organization already uses that slug.
409 capture_not_allowed The capture method does not allow a manual capture.
409 customer_exists Another customer in this project already uses that email.
409 customer_has_payments The customer has payments, so deleting would orphan them.
409 dispute_already_open That payment already has an open dispute.
409 dispute_already_resolved The dispute has already been resolved.
409 dispute_not_closable Only a warning_closed dispute can be closed.
409 dispute_not_respondable The dispute is not in a state that accepts evidence.
409 idempotency_key_in_flight A request with this idempotency key is still running.
409 idempotency_key_reused The idempotency key was reused with a different body.
409 payment_already_cancelled The payment was already cancelled.
409 payment_already_captured The payment has already been captured.
409 payment_cancelled The payment was cancelled, so it cannot be captured.
409 payment_fully_refunded Everything refundable on the payment has already been refunded.
409 payment_method_in_use A payment in flight uses this method, so detaching it would leave that payment without an instrument.
409 payment_method_no_customer A saved method must belong to a customer.
409 payment_not_capturable The payment is not awaiting capture.
409 payment_not_disputable Only a settled payment can be disputed.
409 payment_not_refundable The payment has no captured amount to refund.
409 payout_already_cancelled The payout was already cancelled.
409 payout_already_reversed The payout was already reversed.
409 payout_not_cancellable Only a pending payout can be cancelled.
409 payout_not_reversible Only a paid payout can be reversed.
409 plan_inactive The plan is inactive, so no new subscription may use it.
409 refund_already_cancelled The refund was already cancelled.
409 refund_already_settled The refund already reached a terminal state.
409 session_already_complete The checkout session already completed.
409 session_cancelled The checkout session was cancelled.
409 session_expired The checkout session passed its expiry.
409 subscription_already_cancelled The subscription was already cancelled.
409 subscription_exists That customer already has a subscription to this plan.
409 subscription_not_chargeable The subscription is not in a state that can be charged.
409 subscription_not_pausable The subscription is not in a state that can be paused.
409 subscription_not_paused The subscription is not paused.
409 transfer_already_reversed The transfer was already reversed.
409 transfer_not_reversible Only a settled transfer can be reversed.
409 virtual_account_inactive The virtual account is not active.
409 virtual_account_no_wallet The account has no wallet to credit.
409 wallet_balance_conflict A concurrent movement changed the balance first, so the debit was retried against the new value.
409 wallet_closed The wallet is closed.
409 wallet_frozen The wallet is frozen.
409 wallet_not_empty A closed wallet must be empty first.
404 organization_missing No organization with that slug.
422 currency_mismatch The currency does not match the resource it is being applied to.
422 currency_not_allowed The organization is not enabled for that currency. The message lists what is allowed.
422 dispute_exceeds_payment The disputed amount is more than the payment was for.
422 insufficient_wallet_balance The wallet does not have enough to cover the debit. A wallet never goes negative.
422 refund_exceeds_balance The refund is more than what is still refundable, counting refunds already in flight.
422 session_not_needed The payment resolved immediately, so there is nothing to check out. Use POST /api/v1/payments instead.
Decline codes

A decline is not an API error: the request succeeded and the payment is failed. These appear as decline_code on the payment, and as failure_code for the surrounding reason.

CodeMeaning
generic_decline The issuer declined without giving a reason.
insufficient_funds The cardholder does not have enough available.
expired_card The card is past its expiry date.
incorrect_cvc The security code did not match.
authentication_failed The 3DS challenge was not passed, or passed and then declined.

Response objects#

The shape behind the object discriminator. List endpoints wrap these in { object: "list", has_more, data }.

health #

Liveness response.

FieldTypeMeaning
status string Always ok.
service string Always feignpay.
environment string Node environment, not the project environment.
time string ISO timestamp of the check.

service #

Service description with the URLs worth knowing.

FieldTypeMeaning
service string Always feignpay.
description string What this is.
api_base string Base path for the JSON API.
docs string This page.
console string The sandbox console.

scenario_catalogue #

Everything the scenario engine understands.

FieldTypeMeaning
scenarios array The outcome names accepted by the scenario parameter.
magic_references array Reference prefixes and the outcome each forces.
magic_cards array Card numbers and the outcome each forces.
test_cards array Cards for the hosted checkout, with brand, expiry, CVC, and behaviour.
test_wallets array Mobile money numbers for the hosted checkout, with provider, result, and behaviour. They decide the result only on a session with the pending scenario.

project #

The project behind the presented key.

FieldTypeMeaning
object string Always project.
id string Project public id.
name string Project name.
environment string test or live.
default_currency string Applied when a request omits currency.
default_scenario string Applied when nothing else decides the outcome.
livemode boolean True for the live project.
webhook_url string | null Project default delivery target.
organization object id and name of the owning organization.
organization_capabilities array What the organization is enabled for. A disabled capability returns capability_disabled before the request reaches a handler.
organization_currencies array Currencies the organization may transact in. Anything else returns currency_not_allowed.

api_key #

An API key. The secret value is returned in full, which is a sandbox affordance.

FieldTypeMeaning
object string Always api_key.
id string Key public id.
name string Human label.
type string public, secret, or restricted.
key string The full key value.
prefix string The non secret prefix, for logging safely.
revoked boolean Whether the key was revoked.
created_at integer | null Unix seconds.
last_used_at integer | null Unix seconds.

payment #

A payment and everything the simulator decided about it.

FieldTypeMeaning
object string Always payment.
id string Public id.
status string requires_payment_method, requires_confirmation, requires_action, processing, succeeded, failed, cancelled, partially_refunded, refunded, or disputed.
amount integer Requested amount in minor units.
amount_captured integer Amount actually captured.
amount_refunded integer Amount refunded so far, including refunds still in flight.
amount_remaining integer Requested minus captured.
currency string ISO 4217 code.
fee integer Platform fee in minor units.
net integer Amount less fee.
instrument string card, bank_account, wallet, or ussd.
capture_method string automatic or manual.
reference string | null Your identifier.
description string | null Shown to the payer.
statement_descriptor string | null What appears on a bank statement.
redirect_url string | null Success landing page.
failure_url string | null Failure landing page.
cancel_url string | null Abandon landing page.
webhook_url string | null Target actually used for this payment.
webhook_url_source string request or project, so you always know which URL was used.
failure_code string | null Why it failed, when it did.
failure_message string | null Human readable failure reason.
decline_code string | null Issuer decline code, for the failures that have one.
three_ds object | null Challenge state, including attempts.
card object | null Brand, last four, BIN, and expiry. The number is never stored or returned.
risk object | null Simulated risk signals.
metadata object | null Your metadata, returned verbatim.
livemode boolean True for the live project.
created_at integer | null Unix seconds.
updated_at integer | null Unix seconds.
authorized_at integer | null Unix seconds, when authorisation happened.
captured_at integer | null Unix seconds, on capture.
failed_at integer | null Unix seconds, on failure.
cancelled_at integer | null Unix seconds, on cancellation.
settled_at integer | null Unix seconds, once fully settled.

refundable #

How much is still refundable on a payment.

FieldTypeMeaning
object string Always refundable.
payment string Payment public id.
captured integer Amount captured.
already_refunded integer Amount refunded or reserved.
refundable integer What can still be refunded.
currency string ISO 4217 code.

checkout_session #

A hosted checkout session. The token doubles as the hosted page path.

FieldTypeMeaning
object string Always checkout_session.
id string The session token.
payment_id string Payment public id.
status string open, complete, expired, or cancelled.
amount integer Amount in minor units.
currency string ISO 4217 code.
instrument string Which hosted form is shown.
scenario string | null Scenario the payment resolved to.
three_ds_required boolean Whether a challenge is needed.
three_ds_enrolment boolean Whether enrolment is offered after the code.
three_ds_completed_at integer | null Unix seconds, once the challenge is passed.
three_ds_passed boolean | null Whether the code was correct.
url string The hosted page to redirect the payer to.
expires_at integer | null Unix seconds.
livemode boolean True for the live project.

refund #

A refund.

FieldTypeMeaning
object string Always refund.
id string Public id.
payment string Payment public id.
amount integer Amount in minor units.
currency string ISO 4217 code.
status string pending, processing, succeeded, failed, or cancelled.
reason string duplicate, fraudulent, requested_by_customer, or expired_uncaptured_charge.
note string | null Your internal note.
failure_code string | null Why it failed.
failure_message string | null Human readable failure reason.
created_at integer | null Unix seconds.
succeeded_at integer | null Unix seconds.
failed_at integer | null Unix seconds.
payment_object object id and status of the payment, on retrieve.

payout_beneficiary #

A payout destination.

FieldTypeMeaning
object string Always payout_beneficiary.
id string Public id.
type string bank_account, card, or wallet.
account_name string Name on the account.
account_number string | null Present for bank_account.
bank_code string | null Bank code.
bank_name string | null Bank display name.
country string Two letter country code.
currency string | null Currency restriction, if any.
wallet_code string | null Wallet provider code.
wallet_number string | null Wallet number.
card_last4 string | null Card last four.
card_brand string | null Card brand.
is_default boolean Project default destination.
verified boolean Always true here, since sandbox beneficiaries verify immediately.
created_at integer | null Unix seconds.

payout #

A payout. Advances pending to processing to paid through the scheduler.

FieldTypeMeaning
object string Always payout.
id string Public id.
amount integer Gross amount in minor units.
currency string ISO 4217 code.
fee integer Payout fee.
net integer Amount less fee, debited from the ledger.
status string pending, on_hold, processing, paid, failed, cancelled, or reversed.
reason string | null Why the money is leaving.
reference string | null Your identifier.
failure_code string | null Why it failed.
failure_message string | null Human readable failure reason.
batch string | null Batch public id.
reversal_of string | null The payout this one reverses, as a public id.
beneficiary_id string Beneficiary public id.
scheduled_for integer | null Unix seconds.
processing_at integer | null Unix seconds.
paid_at integer | null Unix seconds.
failed_at integer | null Unix seconds.
cancelled_at integer | null Unix seconds.
created_at integer | null Unix seconds.
updated_at integer | null Unix seconds.

balance #

Organisation balances, summed from the ledger.

FieldTypeMeaning
object string Always balance.
organization_id string Owning organization.
available array One entry per currency, each with currency and amount in minor units.

dispute #

A dispute.

FieldTypeMeaning
object string Always dispute.
id string Public id.
payment string Payment public id.
amount integer Disputed amount in minor units.
currency string ISO 4217 code.
status string needs_response, under_review, won, lost, warning_closed, or chargeback.
reason string Network reason code.
reason_text string | null Cardholder free text.
network_reason_code string | null Network supplied code.
evidence array Submitted evidence entries.
evidence_due_at integer | null Unix seconds.
responded_at integer | null Unix seconds.
resolved_at integer | null Unix seconds.
won_at integer | null Unix seconds.
lost_at integer | null Unix seconds.
created_at integer | null Unix seconds.

evidence_template #

Accepted evidence types and an example entry.

FieldTypeMeaning
object string Always evidence_template.
types array Accepted evidence types.
example object A well formed entry to copy.

transfer #

A transfer between sandbox objects.

FieldTypeMeaning
object string Always transfer.
id string Public id.
amount integer Amount in minor units.
currency string ISO 4217 code.
fee integer Transfer fee.
status string pending, processing, succeeded, failed, or reversed.
reference string | null Your identifier.
failure_code string | null Why it failed.
failure_message string | null Human readable failure reason.
payment string | null Related payment public id.
payout string | null Related payout public id.
reversal_of string | null The transfer this one reverses.
destination object | null Your destination details, verbatim.
settled_at integer | null Unix seconds.
created_at integer | null Unix seconds.

customer #

A payer.

FieldTypeMeaning
object string Always customer.
id string Public id.
email string | null Unique within the project.
name string | null Full name.
phone string | null Phone number.
country string Two letter country code.
default_currency string | null Currency applied when a payment omits one.
metadata object | null Your metadata, verbatim.
created_at integer | null Unix seconds.

customer_deleted #

Result of a delete. Reports whether payments were blocked.

FieldTypeMeaning
object string Always customer_deleted.
id string The customer public id.
deleted boolean True when the customer had no payments.

payment_method #

A saved instrument. Only a token and the last four are ever stored.

FieldTypeMeaning
object string Always payment_method.
id string Public id.
type string card, bank_account, wallet, or ussd.
display_name string | null Your label.
card object | null brand, last4, exp_month, exp_year, bin, country, fingerprint. Never the number.
bank object | null bank_code, bank_name, account_last4.
wallet object | null code and number.
ussd object | null bank_code and bank_name.
is_default boolean Customer default method.
metadata object | null Your metadata, verbatim.
created_at integer | null Unix seconds.

payment_method_detached #

Result of a detach.

FieldTypeMeaning
object string Always payment_method_detached.
id string The method public id.
detached boolean False when a payment in flight still uses it.

plan #

A billing plan.

FieldTypeMeaning
object string Always plan.
id string Public id.
name string Plan name.
amount integer Amount per interval in minor units.
currency string ISO 4217 code.
interval string day, week, month, or year. Named billing_interval in the database because interval is reserved in MySQL 8.
interval_count integer Intervals per period.
trial_days integer Trial length in days.
description string | null Free text.
active boolean Whether new subscriptions may use it.
created_at integer | null Unix seconds.

subscription #

A recurring subscription. Dunning retries on days 1, 3, and 5, then writes it off as unpaid.

FieldTypeMeaning
object string Always subscription.
id string Public id.
status string trialing, active, past_due, paused, cancelled, or unpaid.
customer string Customer public id.
plan string Plan public id.
amount integer | null Plan amount, denormalised for convenience.
currency string | null Plan currency.
current_period_start integer | null Unix seconds.
current_period_end integer | null Unix seconds.
trial_end integer | null Unix seconds.
cancel_at_period_end boolean Whether cancellation is queued for period end.
cancelled_at integer | null Unix seconds.
paused_at integer | null Unix seconds.
next_charge_at integer | null Unix seconds.
failed_attempts integer Consecutive failed charges, which drives dunning.
reference string | null Your identifier.
created_at integer | null Unix seconds.

wallet #

A stored value balance.

FieldTypeMeaning
object string Always wallet.
id string Public id.
customer string | null Customer public id.
currency string ISO 4217 code. One wallet per customer per currency.
balance integer Balance in minor units. Never negative.
status string active, frozen, or closed.
created_at integer | null Unix seconds.

wallet_transaction #

One movement on a wallet.

FieldTypeMeaning
object string Always wallet_transaction.
id string Public id.
type string Movement type, for example topup, debit, or payment.
direction string credit or debit.
amount integer Amount in minor units, always positive.
currency string ISO 4217 code.
balance_after integer Balance following this movement, so the statement can be walked.
reference object | null type and id of what caused the movement.
description string | null Shown on the statement.
created_at integer | null Unix seconds.

wallet_audit #

Result of recomputing balances from statements.

FieldTypeMeaning
object string Always wallet_audit.
wallets_checked integer How many wallets were recomputed.
drift array Wallets whose stored balance disagrees with their statement.
balanced boolean True when drift is empty.

virtual_account #

A unique account number that credits a wallet when funded.

FieldTypeMeaning
object string Always virtual_account.
id string Public id.
account_number string Allocated number, prefixed 999 which is reserved for sandbox use.
bank_name string Simulated bank name.
bank_code string Simulated bank code.
currency string ISO 4217 code.
customer_name string Account holder.
status string active, frozen, or closed.
wallet string Wallet public id that funding credits.
total_funded integer Sum of all funding events.
funding_count integer How many times it was funded.
last_funded_at integer | null Unix seconds of the most recent funding.
created_at integer | null Unix seconds.

virtual_account_funding #

Result of simulating an inbound transfer.

FieldTypeMeaning
object string Always virtual_account_funding.
account object The account, with its new totals.
wallet_transaction_id string The wallet transaction the funding created.

event #

A webhook event and its delivery state.

FieldTypeMeaning
object string Always event.
id string Public id.
type string For example payment.succeeded or payout.paid.
url string | null Target used for delivery.
url_source string request or project.
status string pending, delivering, delivered, failed, abandoned, or skipped.
attempts integer Attempts made so far.
max_attempts integer Attempts before the event is abandoned.
last_error string | null Why the last attempt failed.
last_status_code integer | null What the receiver returned last time.
created_at integer Unix seconds.
delivered_at integer | null Unix seconds on success.
data object The exact payload sent.

webhook_attempt #

One delivery attempt.

FieldTypeMeaning
object string Always webhook_attempt.
attempt integer Attempt number, from 1.
url string Target attempted.
status_code integer | null What the receiver returned.
duration_ms integer | null How long the attempt took.
error string | null Transport error, if the request never completed.
succeeded boolean Whether this attempt counted as delivered.
response_body string | null The body your receiver returned.
created_at integer Unix seconds.

replay #

Result of replaying an event.

FieldTypeMeaning
replayed boolean Always true on success.
original_event_id string The event that was replayed.
event object The new event, queued for delivery.

result #

A simple count of work done.

FieldTypeMeaning
object string Always result.
delivered integer How many events were delivered.

billing_preview #

The date a billing period would land on.

FieldTypeMeaning
object string Always billing_preview.
from integer Unix seconds of the starting date.
interval string Interval unit applied.
count integer How many intervals were added.
next integer Resulting date as Unix seconds.
next_iso string Resulting date as an ISO 8601 string.

list #

The envelope every list endpoint returns.

FieldTypeMeaning
object string Always list.
has_more boolean True when a full page came back, so another may exist.
data array The records.

checkout_page #

The hosted checkout form. HTML, not JSON.

FieldTypeMeaning
html string The page.

challenge_page #

The 3DS challenge. HTML, not JSON.

FieldTypeMeaning
html string The page. The OTP is 123456.

enrolment_page #

Device enrolment. HTML, not JSON.

FieldTypeMeaning
html string The page.

transfer_page #

Bank transfer instructions. HTML, not JSON.

FieldTypeMeaning
html string The page.

wallet_page #

Mobile money approval. HTML, not JSON.

FieldTypeMeaning
html string The page.

cancel_page #

Cancellation confirmation. HTML, not JSON.

FieldTypeMeaning
html string The page.

result_page #

The outcome page. HTML, not JSON.

FieldTypeMeaning
html string The page.

console_page #

A console page. HTML, not JSON. Scoped to the signed-in account.

FieldTypeMeaning
html string The page.

auth_page #

A sign in or sign up page. HTML, not JSON.

FieldTypeMeaning
html string The page.

redirect #

No body. The Location header carries the destination, and signing in or out also sets a cookie.

FieldTypeMeaning
location string Where the browser goes next.

landing_page #

The landing page. HTML, not JSON.

FieldTypeMeaning
hero string What the sandbox is, and the endpoint count read from the catalogue.
quickstart string A copy and paste request, using a real seeded key when one exists.
surface string One card per API group, with its endpoint count.
scenarios string Every scenario the engine can produce, with its magic reference prefixes.
cards string Test cards, split into the ones that force an outcome and the ones that just succeed.
capabilities string The twelve capabilities and what turning each one off stops.
honesty string What the sandbox is not, stated plainly.

docs_page #

This reference. HTML, not JSON.

FieldTypeMeaning
html string The page.