Direct debit
- get/v1/mandatesList direct debit mandates
- post/v1/mandatesAsk a customer for a direct debit mandate
- get/v1/mandates/{id}Get a mandate
- post/v1/mandates/{id}/refreshCheck a pending mandate now
- post/v1/mandates/{id}/chargeDebit an active mandate
- post/v1/mandates/{id}/cancelCancel a mandate
List direct debit mandates
get/v1/mandates
Parameters
customerstring (uuid)in querystatuspending | active | canceled | failedin querycurl https://sandbox.api.biftpay.com/v1/mandates \
-H "Authorization: Bearer bp_test_..."Responses
- 200OKobject
Fields
object"list"requireddataarray of MandaterequiredFields of data
idstring (uuid)requiredobject"mandate"requiredlivemodebooleanrequiredcustomerstring (uuid)requiredcustomer_emailstring | nullrequiredcustomer_namestring | nullrequiredstatuspending | active | canceled | failedrequiredpending: waiting for the customer or their bank. active: can be charged.
authorization_urlstring | nullrequiredWhere the customer approves it (only while pending).
bank_namestring | nullrequiredaccount_namestring | nullrequiredaccount_number_last4string | nullrequiredfailure_reasonstring | nullrequiredWhy it failed: expired (not approved in 7 days) or the provider's reason.
created_atstring (date-time)requiredactivated_atstring (date-time) | nullrequiredcanceled_atstring (date-time) | nullrequiredhas_morebooleanrequired
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.
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 '{}'Responses
- 201Created (pending)Mandate
Fields
idstring (uuid)requiredobject"mandate"requiredlivemodebooleanrequiredcustomerstring (uuid)requiredcustomer_emailstring | nullrequiredcustomer_namestring | nullrequiredstatuspending | active | canceled | failedrequiredpending: waiting for the customer or their bank. active: can be charged.
authorization_urlstring | nullrequiredWhere the customer approves it (only while pending).
bank_namestring | nullrequiredaccount_namestring | nullrequiredaccount_number_last4string | nullrequiredfailure_reasonstring | nullrequiredWhy it failed: expired (not approved in 7 days) or the provider's reason.
created_atstring (date-time)requiredactivated_atstring (date-time) | nullrequiredcanceled_atstring (date-time) | nullrequired - 400Invalid request
Get a mandate
get/v1/mandates/{id}
Parameters
idstring (uuid)in pathrequiredcurl https://sandbox.api.biftpay.com/v1/mandates/{id} \
-H "Authorization: Bearer bp_test_..."Responses
- 200OKMandate
Fields
idstring (uuid)requiredobject"mandate"requiredlivemodebooleanrequiredcustomerstring (uuid)requiredcustomer_emailstring | nullrequiredcustomer_namestring | nullrequiredstatuspending | active | canceled | failedrequiredpending: waiting for the customer or their bank. active: can be charged.
authorization_urlstring | nullrequiredWhere the customer approves it (only while pending).
bank_namestring | nullrequiredaccount_namestring | nullrequiredaccount_number_last4string | nullrequiredfailure_reasonstring | nullrequiredWhy it failed: expired (not approved in 7 days) or the provider's reason.
created_atstring (date-time)requiredactivated_atstring (date-time) | nullrequiredcanceled_atstring (date-time) | nullrequired - 404Not found, or not visible to this key
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 pathrequiredcurl -X POST https://sandbox.api.biftpay.com/v1/mandates/{id}/refresh \
-H "Authorization: Bearer bp_test_..." \
-H "Idempotency-Key: $(uuidgen)"Responses
- 200OKMandate
Fields
idstring (uuid)requiredobject"mandate"requiredlivemodebooleanrequiredcustomerstring (uuid)requiredcustomer_emailstring | nullrequiredcustomer_namestring | nullrequiredstatuspending | active | canceled | failedrequiredpending: waiting for the customer or their bank. active: can be charged.
authorization_urlstring | nullrequiredWhere the customer approves it (only while pending).
bank_namestring | nullrequiredaccount_namestring | nullrequiredaccount_number_last4string | nullrequiredfailure_reasonstring | nullrequiredWhy it failed: expired (not approved in 7 days) or the provider's reason.
created_atstring (date-time)requiredactivated_atstring (date-time) | nullrequiredcanceled_atstring (date-time) | nullrequired - 404Not found, or not visible to this key
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"requireddescriptionstringreferencestringmetadataobjectcurl -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"
}'Responses
- 201The paymentPaymentIntent
Fields
idstring (uuid)requiredobject"payment_intent"requiredlivemodebooleanrequiredamountintegerrequiredMinor units (kobo, cents).
at least 0
currencyNGN | USDrequiredstatuscreated | processing | successful | failed | abandoned | canceledrequiredcreatednot paid yet;processingthe customer started paying (entered a card, or was given an account to transfer into);successfulthe money arrived;failedthe last try failed and the customer may try again;abandonedprocessing for 30 minutes with no money (the customer may still pay);canceledcanceled by the business. Money that arrives late always makes a paymentsuccessful.referencestring | nulldescriptionstring | nullcustomer_emailstring | nullbrandstring (uuid) | nullcustomerstring (uuid) | nullpayment_linkstring (uuid) | nullmetadataobjectrequiredup to 20 keys
fee_bearermerchant | customerrequiredWho pays the fee: the merchant (out of the amount) or the customer (on top of it).
amount_chargedobjectrequiredWhat the customer pays: the amount, plus fee and VAT when the customer bears the fee (an estimate until paid).
feesobjectrequiredAn 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
feeintegerrequiredMinor units (kobo, cents).
at least 0
vatintegerrequiredMinor units (kobo, cents).
at least 0
netintegerrequiredMinor units (kobo, cents).
at least 0
failure_codestring | nullcreated_atstring (date-time)requiredupdated_atstring (date-time)requiredpaid_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
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
curl -X POST https://sandbox.api.biftpay.com/v1/mandates/{id}/cancel \
-H "Authorization: Bearer bp_test_..." \
-H "Idempotency-Key: $(uuidgen)"Responses
- 200OKMandate
Fields
idstring (uuid)requiredobject"mandate"requiredlivemodebooleanrequiredcustomerstring (uuid)requiredcustomer_emailstring | nullrequiredcustomer_namestring | nullrequiredstatuspending | active | canceled | failedrequiredpending: waiting for the customer or their bank. active: can be charged.
authorization_urlstring | nullrequiredWhere the customer approves it (only while pending).
bank_namestring | nullrequiredaccount_namestring | nullrequiredaccount_number_last4string | nullrequiredfailure_reasonstring | nullrequiredWhy it failed: expired (not approved in 7 days) or the provider's reason.
created_atstring (date-time)requiredactivated_atstring (date-time) | nullrequiredcanceled_atstring (date-time) | nullrequired - 404Not found, or not visible to this key