Future payments
Okra's debitLater feature allows you to save a customer’s details without an initial payment. This is helpful if you want to onboard customers now, set them up for payments, and charge them in the future, through the widget or API.
In this section, you'll learn how to charge future payments via the widget, API, and dashboard.
Initiate via the widget
Use this integration to set up recurring payments or to create one-time payments with a final amount determined later, often after the customer receives your service.*
const options = {
{...widget options...}, // https://docs.okra.ng/docs/widget-properties
debitLater: true,
debitAmount: 10000, // optional kobo amount
debitType: 'one-time', 'recurring', or 'ongoing',
debitStartDate: 'YYYY-MM-DD', // optional starting date for recurring
debitEndDate: 'YYYY-MM-DD', // optional starting date for recurring
debitInterval: 'monthly', 'weekly', 'yearly', //optional recurring interval
}
Initiate via the API
Okra gives you the flexibility to set up a debit for a future date and also set when the debit should stop. You can have one-time payment by adding OneTime: true or interval payments by setting interval: monthly/weekly/yearly
url -X POST https://api.okra.ng/v2/pay/authorization/initiate
-H 'Content-Type: application/json'
-H 'Authorization: Bearer <secretKey>'
-d '{
"authorization": "xxxxxxxxxxxxxxxx",
"amount": 10000,
"initialAmount": 7000,
"currency": "NGN",
"startDate": "2021/05/21",
"endDate": "2021/06/27",
"interval": "monthly",
"oneTime": false
}'
{
"status": "success",
"message": "Payment authorization was successfully updated and will begin 2021-03-10 with an initial payment of NGN 10000 and continue with payments of NGN 10000 on an ongoing basis until cancelled",
"data": {
"authorization": {
"_id": "602ba395062f875c2a7d433b",
"customer": "5e9bbfb856ec36e888195d03",
"accounts": [
"6026776de26cb3db2b5250c2"
],
"disconnect": false,
"disconnected_at": null,
"duration": {
"startDate": "2021-03-10T11:49:37.141Z",
"endDate": null,
"oneTime": true,
"interval": "monthly"
},
"initialAmount": 7000,
"initiated": false,
"amount": 10000
}
}
}
Cancel future payment
You can cancel a Payment if you no longer intend to use it to collect payment from the customer.
url -X POST https://api.okra.ng/v2/pay/authorization/cancel
-H 'Content-Type: application/json'
-H 'Authorization: Bearer <secretKey>'
-d '{
"authorization": "60xxxxxxxxxxxxxxxx",
"customer": "xxxxxxxxxxxxxxxx",
"link": "602bxxxxxxxxxxxxxxxx",
"account": "xxxxxxxxxxxxxxxx"
}'
{
"status": "success",
"message": "Payment authorization(s) successfully cancelled!",
"data": {
"authorizations": [
{
"duration": {
"startDate": "2021-03-10T11:49:37.141Z",
"endDate": null,
"interval": null,
"oneTime": true
},
"accounts": [],
"initialAmount": null,
"amount": 10000,
"initiated": false,
"disconnect": true,
"disconnected_at": "2021-03-10T13:12:41.508Z",
"_id": "602ba395062f875c2a7d433b",
"customer": {
"_id": "5e9bbfb856ec36e888195d03",
"name": "Lorem Ipsum"
},
"bank": {
"_id": "5f0cf73e8a8bcc18b8156ad7",
"icon": "https://okra-images.s3.eu-west-3.amazonaws.com/Kuda+icon.svg",
"logo": "https://okra-images.s3.eu-west-3.amazonaws.com/Kuda+Bank+Logo+(White).svg",
"name": "Kuda Bank",
"png_logo": "http://d1f1tz87xvarxp.cloudfront.net/Nigerian+Banks/Kuda+Bank.png"
},
"disconnected_by": "5f2922b59afab10984102e52"
}
]
}
}
Reauthorise future payment
Okra allows you to reauthorise a previously cancelled payment.
Reauthorising a cancelled authorisation (only works if it was not cancelled by the customer).
url -X POST https://api.okra.ng/v2/pay/authorization/reauth
-H 'Content-Type: application/json'
-H 'Authorization: Bearer <secretKey>'
-d '{
"authorization": "60xxxxxxxxxxxxxxxx",
"customer": "xxxxxxxxxxxxxxxx",
"link": "602bxxxxxxxxxxxxxxxx",
"account": "xxxxxxxxxxxxxxxx"
}'
{
"status": "success",
"message": "Payment authorization(s) successfully re-authorized!",
"data": {
"authorizations": [
{
"duration": {
"startDate": "2021-03-10T11:49:37.141Z",
"endDate": null,
"interval": null,
"oneTime": true
},
"accounts": [
{
"_id": "6026776de26cb3db2b5250c2",
"name": "Lorem Ipsum",
"nuban": "4577765436"
}
],
"initialAmount": null,
"amount": 10000,
"initiated": false,
"disconnect": false,
"disconnected_at": null,
"_id": "602ba395062f875c2a7d433b",
"customer": {
"_id": "5e9bbfb856ec36e888195d03",
"name": "Lorem Ipsum"
},
"bank": {
"_id": "5f0cf73e8a8bcc18b8156ad7",
"icon": "https://okra-images.s3.eu-west-3.amazonaws.com/Kuda+icon.svg",
"logo": "https://okra-images.s3.eu-west-3.amazonaws.com/Kuda+Bank+Logo+(White).svg",
"name": "Kuda Bank",
"png_logo": "http://d1f1tz87xvarxp.cloudfront.net/Nigerian+Banks/Kuda+Bank.png"
},
"disconnected_by": null
}
]
}
}
List payment authorisations
You can also view the list of all your payment authorizations.
url -X POST https://api.okra.ng/v2/pay/authorization/list
-H 'Content-Type: application/json'
-H 'Authorization: Bearer <secretKey>'
-d '{
"page": "1"
}'
{
"status": "success",
"message": "Customer payment authorizations successfully retrieved",
"data": {
"authorizations": [
{
"owner": "5d9288ea182d3d000cb7c486",
"env": "production-sandbox",
"link": "602ba2c5cf08f0er4d11df72a,
"payLink": "602ba2c5cf08f006d11df72a",
"customer": "602d7a668299304ef0df55f2",
"accounts": [
{
"_id": "6046795da67cb326c5a1277e",
"bank": {
"_id": "5d6fe57a4099cc4b210bbec0",
"icon": "https://okra-images.s3.eu-west-3.amazonaws.com/Access+Bank+PLC+Logo+Color.svg",
"logo": "https://okra-images.s3.eu-west-3.amazonaws.com/Access+Bank+PLC+Logo.svg",
"name": "Access Bank"
},
"nuban": "2345677887",
"customer": {
"_id": "602d7a668299304ef0df55f2",
"name": "Jane Evans"
},
"name": "Jane Evans"
}
],
"bank": "5d6fe57a4099cc4b210bbec0",
"duration": {
"startDate": null,
"endDate": null,
"interval": null,
"oneTime": true
},
"initiated": false,
"credential": "60467b4ba67cb326c5a16e3a",
"garnish": false,
"history": [
"60467b21a67cb326c5a167f6",
"604680d1a67cb326c5a21264"
],
"disconnect": false,
"disconnected_at": null
}
],
"pagination": {
"totalDocs": 1,
"limit": 10,
"hasPrevPage": false,
"hasNextPage": false,
"page": 1,
"totalPages": 1,
"pagingCounter": 1,
"prevPage": null,
"nextPage": null
}
}
}
Initiate via the dashboard
You can also initiate future payments via the dashboard in minutes, by simply creating a link.
Check out this guide
Updated 22 days ago