List direct debit mandates

get/v1/mandates

Parameters

customerstring (uuid)in query
statuspending | active | canceled | failedin query

Responses

  • 200OKobject
    Show the fields
    object"list"
    dataarray of Mandate
    Fields of data
    idstring (uuid)
    object"mandate"
    livemodeboolean
    customerstring (uuid)
    customer_emailstring | null
    customer_namestring | null
    statuspending | active | canceled | failed

    pending: waiting for the customer or their bank. active: can be charged.

    authorization_urlstring | null

    Where the customer approves it (only while pending).

    bank_namestring | null
    account_namestring | null
    account_number_last4string | null
    failure_reasonstring | null

    Why it failed: expired (not approved in 7 days) or the provider's reason.

    created_atstring (date-time)
    activated_atstring (date-time) | null
    approved_atstring (date-time) | null

    When the customer approved it (pending until their bank activates it).

    canceled_atstring (date-time) | null
    has_moreboolean
bash
curl https://sandbox.api.biftpay.com/v1/mandates \
  -H "Authorization: Bearer bp_test_..."
response
{
  "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 headerrequired

A 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_namestring
callback_urlstring (uri)

Where the customer goes after approving it.

holderobject or object

Who the mandate is for, as their bank account names them. Some banks' mandates need it; the BVN is never stored.

max_amountinteger

The 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"
    livemodeboolean
    customerstring (uuid)
    customer_emailstring | null
    customer_namestring | null
    statuspending | active | canceled | failed

    pending: waiting for the customer or their bank. active: can be charged.

    authorization_urlstring | null

    Where the customer approves it (only while pending).

    bank_namestring | null
    account_namestring | null
    account_number_last4string | null
    failure_reasonstring | null

    Why it failed: expired (not approved in 7 days) or the provider's reason.

    created_atstring (date-time)
    activated_atstring (date-time) | null
    approved_atstring (date-time) | null

    When 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
bash
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 '{}'
response
{
  "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 pathrequired

Responses

  • 200OKMandate
    Show the fields
    idstring (uuid)
    object"mandate"
    livemodeboolean
    customerstring (uuid)
    customer_emailstring | null
    customer_namestring | null
    statuspending | active | canceled | failed

    pending: waiting for the customer or their bank. active: can be charged.

    authorization_urlstring | null

    Where the customer approves it (only while pending).

    bank_namestring | null
    account_namestring | null
    account_number_last4string | null
    failure_reasonstring | null

    Why it failed: expired (not approved in 7 days) or the provider's reason.

    created_atstring (date-time)
    activated_atstring (date-time) | null
    approved_atstring (date-time) | null

    When the customer approved it (pending until their bank activates it).

    canceled_atstring (date-time) | null
  • 404Not found, or not visible to this key
bash
curl https://sandbox.api.biftpay.com/v1/mandates/{id} \
  -H "Authorization: Bearer bp_test_..."
response
{
  "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 pathrequired

Responses

  • 200OKMandate
    Show the fields
    idstring (uuid)
    object"mandate"
    livemodeboolean
    customerstring (uuid)
    customer_emailstring | null
    customer_namestring | null
    statuspending | active | canceled | failed

    pending: waiting for the customer or their bank. active: can be charged.

    authorization_urlstring | null

    Where the customer approves it (only while pending).

    bank_namestring | null
    account_namestring | null
    account_number_last4string | null
    failure_reasonstring | null

    Why it failed: expired (not approved in 7 days) or the provider's reason.

    created_atstring (date-time)
    activated_atstring (date-time) | null
    approved_atstring (date-time) | null

    When the customer approved it (pending until their bank activates it).

    canceled_atstring (date-time) | null
  • 404Not found, or not visible to this key
bash
curl -X POST https://sandbox.api.biftpay.com/v1/mandates/{id}/refresh \
  -H "Authorization: Bearer bp_test_..." \
  -H "Idempotency-Key: $(uuidgen)"
response
{
  "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 pathrequired
Idempotency-Keystringin headerrequired

A unique key per logical request, for example a UUID. Up to 255 characters.

up to 255 characters

Body

amountintegerrequired

In kobo.

at least 100

currency"NGN"required
descriptionstring
referencestring
metadataobject

Responses

  • 201The paymentPaymentIntent
    Show the fields
    idstring (uuid)
    object"payment_intent"
    livemodeboolean
    amountinteger

    Minor units (kobo, cents).

    at least 0

    currencyNGN | USD
    statuscreated | processing | successful | failed | abandoned | canceled

    created not paid yet; processing the customer started paying (entered a card, or was given an account to transfer into); successful the funds arrived; failed the last try failed and the customer may try again; abandoned processing for 30 minutes with no funds (the customer may still pay); canceled canceled by the business. Funds that arrive late always make a payment successful.

    disputeobject | null

    In 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 | lost
    amountinteger

    The disputed amount (held while it's open; back to the customer if lost).

    feeinteger

    The chargeback fee charged (0 unless it was lost).

    fee_vatinteger

    VAT on the chargeback fee.

    referencestring | null
    descriptionstring | null
    customer_emailstring | null
    brandstring (uuid) | null
    customerstring (uuid) | null
    payment_linkstring (uuid) | null
    metadataobject

    up to 20 keys

    fee_bearermerchant | customer

    Who 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_chargedobject

    What the customer pays: the amount, plus fee and VAT when the customer bears the fee (an estimate until paid).

    feesobject

    An 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
    feeinteger

    Minor units (kobo, cents).

    at least 0

    vatinteger

    Minor units (kobo, cents).

    at least 0

    netinteger

    Minor units (kobo, cents).

    at least 0

    failure_codestring | null
    created_atstring (date-time)
    updated_atstring (date-time)
    paid_atstring (date-time) | null

    When the payment became successful.

    canceled_atstring (date-time) | null
    return_urlstring | null

    Where checkout sends the customer after paying.

    checkout_urlstring

    Only 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_secretstring

    Only 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
bash
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"
  }'
response
{
  "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 pathrequired
Idempotency-Keystringin headerrequired

A 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"
    livemodeboolean
    customerstring (uuid)
    customer_emailstring | null
    customer_namestring | null
    statuspending | active | canceled | failed

    pending: waiting for the customer or their bank. active: can be charged.

    authorization_urlstring | null

    Where the customer approves it (only while pending).

    bank_namestring | null
    account_namestring | null
    account_number_last4string | null
    failure_reasonstring | null

    Why it failed: expired (not approved in 7 days) or the provider's reason.

    created_atstring (date-time)
    activated_atstring (date-time) | null
    approved_atstring (date-time) | null

    When the customer approved it (pending until their bank activates it).

    canceled_atstring (date-time) | null
  • 404Not found, or not visible to this key
bash
curl -X POST https://sandbox.api.biftpay.com/v1/mandates/{id}/cancel \
  -H "Authorization: Bearer bp_test_..." \
  -H "Idempotency-Key: $(uuidgen)"
response
{
  "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": "…"
}