Subscriptions
- get/v1/customers/{id}/payment_methodsA customer's saved cards
- get/v1/subscriptionsList subscriptions
- post/v1/subscriptionsCharge a saved card every week, month or year
- post/v1/subscriptions/{id}/cancelCancel a subscription
A customer's saved cards
get/v1/customers/{id}/payment_methods
Parameters
idstring (uuid)in pathrequiredbash
curl https://sandbox.api.biftpay.com/v1/customers/{id}/payment_methods \
-H "Authorization: Bearer bp_test_..."Responses
- 200OKobject
Fields
object"list"requireddataarray of PaymentMethodrequiredFields of data
idstring (uuid)requiredobject"payment_method"requiredbrandstring | nulllast4stringrequiredexp_monthintegerrequiredexp_yearintegerrequiredcreated_atstring (date-time)requiredhas_moreboolean
List subscriptions
get/v1/subscriptions
Parameters
customerstring (uuid)in queryOnly this customer's
statusactive | past_due | canceledin querybash
curl https://sandbox.api.biftpay.com/v1/subscriptions \
-H "Authorization: Bearer bp_test_..."Responses
- 200OKobject
Fields
object"list"requireddataarray of SubscriptionrequiredFields of data
idstring (uuid)requiredobject"subscription"requiredlivemodebooleanrequiredcustomerstring (uuid)requiredpayment_methodstring (uuid)requiredbrandstring (uuid) | nulldescriptionstringrequiredamountintegerrequiredMinor units (kobo, cents).
at least 0
currencyNGN | USDrequiredintervalweekly | monthly | yearlyrequiredstatusactive | past_due | canceledrequirednext_charge_atstring (date-time)requiredfailed_attemptsintegerrequiredlatest_paymentstring (uuid) | nullcreated_atstring (date-time)requiredcanceled_atstring (date-time) | nullhas_moreboolean
Charge a saved card every week, month or year
post/v1/subscriptions
Save the card first: create a payment with save_payment_method true and a customer, and pay it at checkout. The first charge happens at start_at (default now).
Parameters
Idempotency-Keystringin headerrequiredA unique key per logical request, for example a UUID. Up to 255 characters.
up to 255 characters
Body
payment_methodstring (uuid)requiredamountintegerrequiredat least 1
currencyNGN | USDintervalweekly | monthly | yearlyrequireddescriptionstringrequiredup to 200 characters
brandstring (uuid)start_atstring (date-time)bash
curl -X POST https://sandbox.api.biftpay.com/v1/subscriptions \
-H "Authorization: Bearer bp_test_..." \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"payment_method": "…",
"amount": 1,
"interval": "weekly",
"description": "…"
}'Responses
- 201OKSubscription
Fields
idstring (uuid)requiredobject"subscription"requiredlivemodebooleanrequiredcustomerstring (uuid)requiredpayment_methodstring (uuid)requiredbrandstring (uuid) | nulldescriptionstringrequiredamountintegerrequiredMinor units (kobo, cents).
at least 0
currencyNGN | USDrequiredintervalweekly | monthly | yearlyrequiredstatusactive | past_due | canceledrequirednext_charge_atstring (date-time)requiredfailed_attemptsintegerrequiredlatest_paymentstring (uuid) | nullcreated_atstring (date-time)requiredcanceled_atstring (date-time) | null - 400Invalid request
Cancel a subscription
post/v1/subscriptions/{id}/cancel
Parameters
idstring (uuid)in pathrequiredIdempotency-Keystringin headerrequiredA unique key per logical request, for example a UUID. Up to 255 characters.
up to 255 characters
bash
curl -X POST https://sandbox.api.biftpay.com/v1/subscriptions/{id}/cancel \
-H "Authorization: Bearer bp_test_..." \
-H "Idempotency-Key: $(uuidgen)"Responses
- 200OKSubscription
Fields
idstring (uuid)requiredobject"subscription"requiredlivemodebooleanrequiredcustomerstring (uuid)requiredpayment_methodstring (uuid)requiredbrandstring (uuid) | nulldescriptionstringrequiredamountintegerrequiredMinor units (kobo, cents).
at least 0
currencyNGN | USDrequiredintervalweekly | monthly | yearlyrequiredstatusactive | past_due | canceledrequirednext_charge_atstring (date-time)requiredfailed_attemptsintegerrequiredlatest_paymentstring (uuid) | nullcreated_atstring (date-time)requiredcanceled_atstring (date-time) | null - 404Not found, or not visible to this key