Payment intents
- get/v1/payment_intentsList payment intents
- post/v1/payment_intentsCreate a payment intent
- get/v1/payment_intents/{id}Retrieve a payment intent
- post/v1/payment_intents/{id}/cancelCancel a payment intent
- get/v1/payment_intents/{id}/charge_attemptsEvery try behind a payment, in order
List payment intents
get/v1/payment_intents
Parameters
limitintegerin query1 to 100 · default 20
starting_afterstring (uuid)in queryThe id of the last item on the previous page.
customerstring (uuid)in querystatuscreated | processing | successful | failed | abandoned | canceledin querycurl https://sandbox.api.biftpay.com/v1/payment_intents \
-H "Authorization: Bearer bp_test_..."Responses
- 200A page of payment intentsPaymentIntentList
Fields
object"list"requireddataarray of PaymentIntentrequiredFields of data
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
feesobjectrequiredAn estimate (at the card price) until the payment succeeds; then final, at the price for the channel and provider that took it. fee + vat + net = amount.
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.
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.
has_morebooleanrequired - 401Missing or invalid API key
Create a payment intent
post/v1/payment_intents
Fees and VAT are calculated from the merchant's pricing and fixed on the intent at creation.
Parameters
Idempotency-Keystringin headerrequiredA unique key per logical request, for example a UUID. Up to 255 characters.
up to 255 characters
Body
amountintegerrequiredat least 1
currencyNGN | USDrequiredreferencestringYour own reference; unique per merchant and mode.
up to 100 characters
descriptionstringup to 500 characters
customer_emailstring (email)customer_namestringup to 200 characters
brandstring (uuid)Attribute the payment to one of your brands.
save_payment_methodbooleanSave the card used at checkout for subscriptions. Needs customer_email.
metadataobjectup to 20 keys
return_urlstringWhere checkout sends the customer after a successful payment, with payment_intent and
status added to the query. https only (http is accepted in test mode). Don't treat the
redirect as proof of payment: confirm with the webhook or GET /v1/payment_intents/{id}.
up to 2000 characters
curl -X POST https://sandbox.api.biftpay.com/v1/payment_intents \
-H "Authorization: Bearer bp_test_..." \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"amount": 1000000,
"currency": "NGN"
}'Responses
- 201CreatedPaymentIntent
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
feesobjectrequiredAn estimate (at the card price) until the payment succeeds; then final, at the price for the channel and provider that took it. fee + vat + net = amount.
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.
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
- 401Missing or invalid API key
- 409The object is in a state that doesn't allow this
- 422Idempotency-Key reused with a different request
Retrieve a payment intent
get/v1/payment_intents/{id}
Parameters
idstring (uuid)in pathrequiredcurl https://sandbox.api.biftpay.com/v1/payment_intents/{id} \
-H "Authorization: Bearer bp_test_..."Responses
- 200The payment intentPaymentIntent
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
feesobjectrequiredAn estimate (at the card price) until the payment succeeds; then final, at the price for the channel and provider that took it. fee + vat + net = amount.
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.
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.
- 401Missing or invalid API key
- 404Not found, or not visible to this key
Cancel a payment intent
post/v1/payment_intents/{id}/cancel
Only an unpaid intent (status created, failed or abandoned) can be canceled.
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/payment_intents/{id}/cancel \
-H "Authorization: Bearer bp_test_..." \
-H "Idempotency-Key: $(uuidgen)"Responses
- 200The canceled payment intentPaymentIntent
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
feesobjectrequiredAn estimate (at the card price) until the payment succeeds; then final, at the price for the channel and provider that took it. fee + vat + net = amount.
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.
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.
- 404Not found, or not visible to this key
- 409The object is in a state that doesn't allow this
Every try behind a payment, in order
get/v1/payment_intents/{id}/charge_attempts
Each card or transfer try, in order: for example a declined card followed by one that worked.
Parameters
idstring (uuid)in pathrequiredcurl https://sandbox.api.biftpay.com/v1/payment_intents/{id}/charge_attempts \
-H "Authorization: Bearer bp_test_..."Responses
- 200Attemptsobject
Fields
object"list"requireddataarray of ChargeAttemptrequiredFields of data
idstring (uuid)requiredobject"charge_attempt"requiredchannelcard | bank_transfer | virtual_accountrequiredstatuspending | succeeded | failed | unknown | canceledrequiredfailure_codestring | nullhas_moreboolean - 404Not found, or not visible to this key