Direct debit
List direct debit mandates
get/v1/mandates
Parameters
customerstring (uuid)in querystatuspending | active | canceled | failedin queryResponses
- 200OKobject
Show the fields
object"list"dataarray of MandateFields of data
idstring (uuid)object"mandate"livemodebooleancustomerstring (uuid)customer_emailstring | nullcustomer_namestring | nullstatuspending | active | canceled | failedpending: waiting for the customer or their bank. active: can be charged.
authorization_urlstring | nullWhere the customer approves it (only while pending).
bank_namestring | nullaccount_namestring | nullaccount_number_last4string | nullfailure_reasonstring | nullWhy it failed: expired (not approved in 7 days) or the provider's reason.
created_atstring (date-time)activated_atstring (date-time) | nullapproved_atstring (date-time) | nullWhen the customer approved it (pending until their bank activates it).
canceled_atstring (date-time) | nullhas_moreboolean
curl https://sandbox.api.biftpay.com/v1/mandates \
-H "Authorization: Bearer bp_test_..."{
"object": "list",
"data": [
{
"id": "…",
"object": "mandate",
"livemode": true,
"customer": "…",
"customer_email": "…",
"customer_name": "…",
"status": "pending",
"authorization_url": "…",
"bank_name": "…",
"account_name": "…",
"account_number_last4": "…",
"failure_reason": "…",
"created_at": "…",
"activated_at": "…",
"canceled_at": "…"
}
],
"has_more": true
}Ask a customer for a direct debit mandate
post/v1/mandates
Send the customer to authorization_url: they choose their bank and approve debits
there. The mandate is active once their bank confirms it (it can take up to a day);
until then it's pending, and one not approved in 7 days fails. Then charge it with
POST /v1/mandates/{id}/charge. Nigeria only (naira), for the banks the provider supports.
Parameters
Idempotency-Keystringin headerrequiredA unique key per logical request, for example a UUID. Up to 255 characters.
up to 255 characters
Body
customerstring (uuid)An existing customer. Send this or customer_email.
customer_emailstring (email)customer_namestringcallback_urlstring (uri)Where the customer goes after approving it.
holderobject or objectWho the mandate is for, as their bank account names them. Some banks' mandates need it; the BVN is never stored.
max_amountintegerThe most the mandate may debit in total (kobo), where the bank's mandate has a cap. Default ₦5,000,000.
at least 20000
end_datestring (date)The mandate's last day, where the bank's mandate has one. Default a year from today.
Responses
- 201Created (pending)Mandate
Show the fields
idstring (uuid)object"mandate"livemodebooleancustomerstring (uuid)customer_emailstring | nullcustomer_namestring | nullstatuspending | active | canceled | failedpending: waiting for the customer or their bank. active: can be charged.
authorization_urlstring | nullWhere the customer approves it (only while pending).
bank_namestring | nullaccount_namestring | nullaccount_number_last4string | nullfailure_reasonstring | nullWhy it failed: expired (not approved in 7 days) or the provider's reason.
created_atstring (date-time)activated_atstring (date-time) | nullapproved_atstring (date-time) | nullWhen the customer approved it (pending until their bank activates it).
canceled_atstring (date-time) | null - 400Invalid request
- 409The object is in a state that doesn't allow this
- 422Idempotency-Key reused with a different request
curl -X POST https://sandbox.api.biftpay.com/v1/mandates \
-H "Authorization: Bearer bp_test_..." \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{}'{
"id": "…",
"object": "mandate",
"livemode": true,
"customer": "…",
"customer_email": "…",
"customer_name": "…",
"status": "pending",
"authorization_url": "…",
"bank_name": "…",
"account_name": "…",
"account_number_last4": "…",
"failure_reason": "…",
"created_at": "…",
"activated_at": "…",
"canceled_at": "…"
}Get a mandate
get/v1/mandates/{id}
Parameters
idstring (uuid)in pathrequiredResponses
- 200OKMandate
Show the fields
idstring (uuid)object"mandate"livemodebooleancustomerstring (uuid)customer_emailstring | nullcustomer_namestring | nullstatuspending | active | canceled | failedpending: waiting for the customer or their bank. active: can be charged.
authorization_urlstring | nullWhere the customer approves it (only while pending).
bank_namestring | nullaccount_namestring | nullaccount_number_last4string | nullfailure_reasonstring | nullWhy it failed: expired (not approved in 7 days) or the provider's reason.
created_atstring (date-time)activated_atstring (date-time) | nullapproved_atstring (date-time) | nullWhen the customer approved it (pending until their bank activates it).
canceled_atstring (date-time) | null - 404Not found, or not visible to this key
curl https://sandbox.api.biftpay.com/v1/mandates/{id} \
-H "Authorization: Bearer bp_test_..."{
"id": "…",
"object": "mandate",
"livemode": true,
"customer": "…",
"customer_email": "…",
"customer_name": "…",
"status": "pending",
"authorization_url": "…",
"bank_name": "…",
"account_name": "…",
"account_number_last4": "…",
"failure_reason": "…",
"created_at": "…",
"activated_at": "…",
"canceled_at": "…"
}Check a pending mandate now
post/v1/mandates/{id}/refresh
Asks the provider whether the customer has approved it (Biftpay also checks every few minutes).
Parameters
idstring (uuid)in pathrequiredResponses
- 200OKMandate
Show the fields
idstring (uuid)object"mandate"livemodebooleancustomerstring (uuid)customer_emailstring | nullcustomer_namestring | nullstatuspending | active | canceled | failedpending: waiting for the customer or their bank. active: can be charged.
authorization_urlstring | nullWhere the customer approves it (only while pending).
bank_namestring | nullaccount_namestring | nullaccount_number_last4string | nullfailure_reasonstring | nullWhy it failed: expired (not approved in 7 days) or the provider's reason.
created_atstring (date-time)activated_atstring (date-time) | nullapproved_atstring (date-time) | nullWhen the customer approved it (pending until their bank activates it).
canceled_atstring (date-time) | null - 404Not found, or not visible to this key
curl -X POST https://sandbox.api.biftpay.com/v1/mandates/{id}/refresh \
-H "Authorization: Bearer bp_test_..." \
-H "Idempotency-Key: $(uuidgen)"{
"id": "…",
"object": "mandate",
"livemode": true,
"customer": "…",
"customer_email": "…",
"customer_name": "…",
"status": "pending",
"authorization_url": "…",
"bank_name": "…",
"account_name": "…",
"account_number_last4": "…",
"failure_reason": "…",
"created_at": "…",
"activated_at": "…",
"canceled_at": "…"
}Debit an active mandate
post/v1/mandates/{id}/charge
Creates a payment for the amount and debits the customer's account. The business bears
the fee. A bank debit can take a while: the payment stays processing until the bank
confirms, then payment_intent.successful or payment_intent.failed is sent. The same
Idempotency-Key never debits twice.
Parameters
idstring (uuid)in pathrequiredIdempotency-Keystringin headerrequiredA unique key per logical request, for example a UUID. Up to 255 characters.
up to 255 characters
Body
amountintegerrequiredIn kobo.
at least 100
currency"NGN"requireddescriptionstringreferencestringmetadataobjectResponses
- 201The paymentPaymentIntent
Show the fields
idstring (uuid)object"payment_intent"livemodebooleanamountintegerMinor units (kobo, cents).
at least 0
currencyNGN | USDstatuscreated | processing | successful | failed | abandoned | canceledcreatednot paid yet;processingthe customer started paying (entered a card, or was given an account to transfer into);successfulthe funds arrived;failedthe last try failed and the customer may try again;abandonedprocessing for 30 minutes with no funds (the customer may still pay);canceledcanceled by the business. Funds that arrive late always make a paymentsuccessful.disputeobject | nullIn GET /v1/payment_intents and GET /v1/payment_intents/{id}: its chargeback, if a customer's bank disputed it (a payment is disputed once).
Fields of dispute
idstring (uuid)statusneeds_response | under_review | won | lostamountintegerThe disputed amount (held while it's open; back to the customer if lost).
feeintegerThe chargeback fee charged (0 unless it was lost).
fee_vatintegerVAT on the chargeback fee.
referencestring | nulldescriptionstring | nullcustomer_emailstring | nullbrandstring (uuid) | nullcustomerstring (uuid) | nullpayment_linkstring (uuid) | nullmetadataobjectup to 20 keys
fee_bearermerchant | customerWho paid the fee on this payment: the merchant (out of the amount) or the customer (on top of it, in amount_charged). Set by your fee setting in the merchant portal when the payment was created.
amount_chargedobjectWhat the customer pays: the amount, plus fee and VAT when the customer bears the fee (an estimate until paid).
feesobjectAn estimate (at the card price) until the payment succeeds; then final, at the price for the channel and provider that took it. Merchant bears the fee: fee + vat + net = amount. Customer bears it: net = amount, and the customer paid amount + fee + vat.
Fields of fees
feeintegerMinor units (kobo, cents).
at least 0
vatintegerMinor units (kobo, cents).
at least 0
netintegerMinor units (kobo, cents).
at least 0
failure_codestring | nullcreated_atstring (date-time)updated_atstring (date-time)paid_atstring (date-time) | nullWhen the payment became successful.
canceled_atstring (date-time) | nullreturn_urlstring | nullWhere checkout sends the customer after paying.
checkout_urlstringOnly in the response that creates the payment: a short link to Biftpay's hosted checkout for it, to send the customer (WhatsApp, SMS, email). Like client_secret, it opens this one payment only.
client_secretstringOnly in the response that creates the payment. Give it to the customer's checkout page; it can act on this one payment only.
- 400Invalid request
- 404Not found, or not visible to this key
- 409The object is in a state that doesn't allow this
curl -X POST https://sandbox.api.biftpay.com/v1/mandates/{id}/charge \
-H "Authorization: Bearer bp_test_..." \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"amount": 100,
"currency": "NGN"
}'{
"id": "0b6f3f0e-6c1a-4d8e-9b0a-5f1e2d3c4b5a",
"object": "payment_intent",
"livemode": false,
"amount": 0,
"currency": "NGN",
"status": "created",
"metadata": {
"order_id": "10293"
},
"fee_bearer": "merchant",
"amount_charged": {},
"fees": {
"fee": 0,
"vat": 0,
"net": 0
},
"created_at": "…",
"updated_at": "…"
}Cancel a mandate
post/v1/mandates/{id}/cancel
No more debits can be made with it. Debits already started still finish.
Parameters
idstring (uuid)in pathrequiredIdempotency-Keystringin headerrequiredA unique key per logical request, for example a UUID. Up to 255 characters.
up to 255 characters
Responses
- 200OKMandate
Show the fields
idstring (uuid)object"mandate"livemodebooleancustomerstring (uuid)customer_emailstring | nullcustomer_namestring | nullstatuspending | active | canceled | failedpending: waiting for the customer or their bank. active: can be charged.
authorization_urlstring | nullWhere the customer approves it (only while pending).
bank_namestring | nullaccount_namestring | nullaccount_number_last4string | nullfailure_reasonstring | nullWhy it failed: expired (not approved in 7 days) or the provider's reason.
created_atstring (date-time)activated_atstring (date-time) | nullapproved_atstring (date-time) | nullWhen the customer approved it (pending until their bank activates it).
canceled_atstring (date-time) | null - 404Not found, or not visible to this key
curl -X POST https://sandbox.api.biftpay.com/v1/mandates/{id}/cancel \
-H "Authorization: Bearer bp_test_..." \
-H "Idempotency-Key: $(uuidgen)"{
"id": "…",
"object": "mandate",
"livemode": true,
"customer": "…",
"customer_email": "…",
"customer_name": "…",
"status": "pending",
"authorization_url": "…",
"bank_name": "…",
"account_name": "…",
"account_number_last4": "…",
"failure_reason": "…",
"created_at": "…",
"activated_at": "…",
"canceled_at": "…"
}