Recurring Payments

Recurring payments or subscriptions are scheduled payments to pay for products or services that occurs frequently. For example, a cardholder paying for an on-demand internet service provider's monthly subscriptions fee without having to manually pay every month.
After first successful payment from the customers card. The card is stored as tokens which will be used for subsequent transactions. Note that recurrent transaction works only for cards

Create Subscription

You can create a plan by calling the Create Plan endpoint or you can do this directly from the SeerBit Merchant Dashboard

Create Plan

For the full specification, see our API Reference
Request Sample
The code snippet below shows an example response for creating a subscription
Billing Cycle should be set to : DAILY, WEEKLY, MONTHLY OR ANNUALLY
1curl --location 'https://merchants.seerbitapi.com/api/v1/recurrent/plan/create' \
2--header 'Content-Type: application/json' \
3--header 'Authorization: Bearer Token\
4--data '{
5    "productId": "<Plan name>",
6    "productDescription": "<Description of Plan>",
7    "amount": "100",
8    "billingCycle": "HOURLY",
9    "limit": 5,
10    "publicKey": "<public key>",
11    "country": "NG",
12    "currency": "NGN",
13    "allowPartialDebit": false
14}'
1var request = require('request');
2var options = {
3  'method': 'POST',
4  'url': 'https://merchants.seerbitapi.com/api/v1/recurrent/plan/create',
5  'headers': {
6    'Content-Type': 'application/json',
7    'Authorization': 'Bearer Token'
8  },
9  body: JSON.stringify({
10    "productId": "<Plan Name>",
11    "productDescription": "<Description of Plan>",
12    "amount": "100",
13    "billingCycle": "HOURLY",
14    "limit": 5,
15    "publicKey": "<Public key>",
16    "country": "NG",
17    "currency": "NGN",
18    "allowPartialDebit": false
19  })
20};
21request(options, function (error, response) {
22  if (error) throw new Error(error);
23  console.log(response.body);
24});
1<?php
2$curl = curl_init();
3curl_setopt_array($curl, array(
4  CURLOPT_URL => 'https://merchants.seerbitapi.com/api/v1/recurrent/plan/create',
5  CURLOPT_RETURNTRANSFER => true,
6  CURLOPT_ENCODING => '',
7  CURLOPT_MAXREDIRS => 10,
8  CURLOPT_TIMEOUT => 0,
9  CURLOPT_FOLLOWLOCATION => true,
10  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
11  CURLOPT_CUSTOMREQUEST => 'POST',
12  CURLOPT_POSTFIELDS =>'{
13    "productId": "<Plan Name>",
14    "productDescription": "<Description of Plan>",
15    "amount": "100",
16    "billingCycle": "HOURLY",
17    "limit": 5,
18    "publicKey": "<Public Key>",
19    "country": "NG",
20    "currency": "NGN",
21    "allowPartialDebit": false
22}',
23  CURLOPT_HTTPHEADER => array(
24    'Content-Type: application/json',
25    'Authorization: Bearer Token'
26  ),
27));
28$response = curl_exec($curl);
29curl_close($curl);
30echo $response;
Response Sample
The code snippet below shows an example response for creating a subscription
1{
2    "payload": {
3        "country": "NG",
4        "createdAt": 1715607343498,
5        "amount": 100,
6        "productId": "<Plan name>",
7        "billingCycle": "HOURLY",
8        "currency": "NGN",
9        "payUrl": "https://pay.seerbitapi.com/db1ea861993689a57dac",
10        "details": {
11            "country": "NG",
12            "amount": 100,
13            "productId": "<Plan name>",
14            "allowPartialDebit": false,
15            "payLinkUrl": "https://pay.seerbitapi.com/db1ea861993689a57dac",
16            "publicKey": "<public key>",
17            "createdAt": 1715607343498,
18            "trialDuration": 0,
19            "trialPeriod": false,
20            "billingCycle": "HOURLY",
21            "limit": 5,
22            "planId": "db1ea861993689a57dac",
23            "currency": "NGN",
24            "id": 20031,
25            "productDescription": "<description of plan>",
26            "updatedAt": null,
27            "status": "ACTIVE"
28        },
29        "publicKey": "<public key>",
30        "plan": "db1ea861993689a57dac",
31        "productDescription": "<description of plan>"
32    },
33    "message": "Successful",
34    "status": "SUCCESS",
35    "responseCode": "00"
36}
1{
2"message": "Bad Request",
3"error": "There has been a problem with reading or understanding the request."
4}
1{
2  "message": "Invalid Authentication Token",
3  "error": "INPUT"
4}

Get Merchant Subscription

The Get Merchant Subscription returns all customer subscriptions. Included in the response is authorizationCode which can be used for separate charges to the customer
For the full specification, see our API Reference
Response Sample
The code snippet below shows an example response to get merchant subscription
1{
2    "status": "SUCCESS",
3    "data": {
4      "subscriptions": [
5        {
6          "publicKey": "SBTEST**************************viTF",
7          "amount": "20",
8          "country": "NG",
9          "customerId": "651d33a62ad69c9f37c4", 
10          "cardName": "Jane Smith",
11          "cardNumber": "2223-00xx-xxxx-0007", 
12          "plan": "ae702f51220000722dca",
13          "status": "ACTIVE",
14          "billingId": "WQ6676yPOpr12348o", 
15          "authorizationCode": "2beb0ccdd347e604552a", 
16          "startDate": "2019-01-11 00:00:00", 
17          "createdAt": 1578648329000
18        }, 
19        {
20          "publicKey":"SBTEST**************************viTF", 
21          "amount": "100",
22          "country": "NG",
23          "customerId": "ba981a0b7ed1c68ad245", 
24          "cardName": "Jane Smith",
25          "cardNumber": "5123-45xx-xxxx-0008", 
26          "plan": "ead5e697f42c1cd60813",
27          "status": "ACTIVE",
28          "billingId": "PUBK_PjQ5d1578649732262", 
29          "authorizationCode": "145a3bb3418824c14d65", 
30          "startDate": "2020-10-01 10:47:49", 
31          "createdAt": 1578649752000
32        }
33      ],
34      "code": "00",
35      "message": "successful"
36     }
37 }

Charge Subscription

For the full specification, see our API Reference
Request Sample
The code snippet below shows an example request for charging a customer with an authorizationCode
Authorise Charge - AuthorizationCode is gotten when a subscription has been successfully completed
1curl --location 'https://seerbitapi.com/api/v2/recurring/charge' \
2--header 'Content-Type: application/json' \
3--header 'Authorization: Bearer YOUR_ENCRYPTED_KEY' \
4--data-raw '{
5	"amount":"200", 
6	"publicKey":"YOUR_PUBLIC_KEY", 
7	"email":"js@emaildomain.com", 
8  "allowPartialDebit":"true",
9	"authorizationCode":"1234567898765325", 
10	"paymentReference":"2938765582R37065687631",
11	"currency":"NGN"
12}'
1var request = require('request');
2var options = {
3  'method': 'POST',
4  'url': 'https://seerbitapi.com/api/v2/recurring/charge',
5  'headers': {
6    'Content-Type': 'application/json',
7    'Authorization': 'Bearer YOUR_ENCRYPTED_KEY'
8  },
9  body: JSON.stringify({
10    "amount": "200",
11    "publicKey": "YOUR_PUBLIC_KEY",
12    "email": "js@emaildomain.com",
13    "allowPartialDebit": "true",
14    "authorizationCode": "1234567898765325",
15    "paymentReference": "2938765582R37065687631",
16    "currency": "NGN"
17  })
18
19};
20request(options, function (error, response) {
21  if (error) throw new Error(error);
22  console.log(response.body);
23});
1<?php
2
3$curl = curl_init();
4
5curl_setopt_array($curl, array(
6  CURLOPT_URL => 'https://seerbitapi.com/api/v2/recurring/charge',
7  CURLOPT_RETURNTRANSFER => true,
8  CURLOPT_ENCODING => '',
9  CURLOPT_MAXREDIRS => 10,
10  CURLOPT_TIMEOUT => 0,
11  CURLOPT_FOLLOWLOCATION => true,
12  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13  CURLOPT_CUSTOMREQUEST => 'POST',
14  CURLOPT_POSTFIELDS =>'{
15	"amount":"200", 
16	"publicKey":"YOUR_PUBLIC_KEY", 
17	"email":"js@emaildomain.com", 
18  "allowPartialDebit":"true",
19	"authorizationCode":"1234567898765325", 
20	"paymentReference":"2938765582R37065687631",
21	"currency":"NGN"
22}',
23  CURLOPT_HTTPHEADER => array(
24    'Content-Type: application/json',
25    'Authorization: Bearer YOUR_ENCRYPTED_KEY'
26  ),
27));
28
29$response = curl_exec($curl);
30
31curl_close($curl);
32echo $response;
Response Sample
The code snippet below shows an example response for charging a subscription
1{
2  "status": "SUCCESS",
3  "data": {
4     "code": "00",
5     "payments": {
6         "code": "00",
7         "message": "Successful",
8         "paymentReference": "2938765582R37065687631",
9         "publicKey": "SBTEST**************************viTF",
10         "amount": "200",
11         "currency": "NGN",
12         "country": "NG",
13         "email": "js@emaildomain.com", 
14         "productDescription": "Authorised charge"
15      },
16      "message": "Successful"
17	}
18}
1{
2"message": "Bad Request",
3"error": "There has been a problem with reading or understanding the request."
4}
1{
2  "message": "Invalid Authentication Token",
3  "error": "INPUT"
4}

Get Customer Subscription

For the full specification, see our API Reference
Response Sample
The code snippet below shows an example response to get customer subscription by customerId
1{
2	"status": "SUCCESS",
3	"data": {
4    "subscriptions": [
5      {
6        "publicKey": "SBTEST**************************viTF",
7        "amount": "100",
8        "country": "NG",
9        "customerId": "ba981a0b7ed1c68ad245", 
10        "cardName": "Jane Smith",
11        "cardNumber": "5123-45xx-xxxx-0008", 
12        "plan": "ead5e697f42c1cd60813",
13        "status": "ACTIVE",
14        "billingId": "PUBK_PjQ5d1578649732262", 
15        "authorizationCode": "145a3bb3418824c14d65", 
16        "startDate": "2020-10-01 10:47:49", 
17        "createdAt": 1578649752000
18      }, 
19      {
20        "publicKey": "SBTEST**************************viTF",
21        "amount": "20000",
22        "country": "NG",
23        "customerId": "ba981a0b7ed1c68ad245", 
24        "cardName": "John Smith", 
25        "cardNumber": "5123-45xx-xxxx-0008", 
26        "plan": "80b0854b35a0e279efc3", 
27        "status": "INACTIVE",
28        "billingId": "PUBK_PjQ5d1578650322483", 
29        "authorizationCode": "ddfce36aa4f3abc7cf72", 
30        "startDate": "2020-10-01 10:58:25", 
31        "createdAt": 1578650353000
32      }
33    ],
34    "code": "00",
35 }

Update Customer Subscription

For the full specification, see our API Reference
Request Sample
The code snippet below shows an example request for updating a subscription
For Credit cards, you can update the previously stored payment details. This may be required when the card expiry date or the billing/delivery address changes.
1curl --location --request PUT 'https://seerbitapi.com/api/v2/recurring/updates' \
2--header 'Content-Type: application/json' \
3--header 'Authorization: Bearer YOUR_ENCRYPTED_KEY' \
4--data '{
5"amount":"20000",
6"currency":"NGN",
7"country":"NG",
8"mobileNumber":"08033456500", 
9"billingId":"PUBK_PjQ5d1578650322483", 
10"publicKey":"YOUR_PULIC_KEY", 
11"status":"INACTIVE"
12}'
1var request = require('request');
2var options = {
3  'method': 'PUT',
4  'url': 'https://seerbitapi.com/api/v2/recurring/updates',
5  'headers': {
6    'Content-Type': 'application/json',
7    'Authorization': 'Bearer YOUR_ENCRYPTED_KEY'
8  },
9  body: JSON.stringify({
10    "amount": "20000",
11    "currency": "NGN",
12    "country": "NG",
13    "mobileNumber": "08033456500",
14    "billingId": "PUBK_PjQ5d1578650322483",
15    "publicKey": "YOUR_PULIC_KEY",
16    "status": "INACTIVE"
17  })
18
19};
20request(options, function (error, response) {
21  if (error) throw new Error(error);
22  console.log(response.body);
23});
1<?php
2
3$curl = curl_init();
4
5curl_setopt_array($curl, array(
6  CURLOPT_URL => 'https://seerbitapi.com/api/v2/recurring/updates',
7  CURLOPT_RETURNTRANSFER => true,
8  CURLOPT_ENCODING => '',
9  CURLOPT_MAXREDIRS => 10,
10  CURLOPT_TIMEOUT => 0,
11  CURLOPT_FOLLOWLOCATION => true,
12  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13  CURLOPT_CUSTOMREQUEST => 'PUT',
14  CURLOPT_POSTFIELDS =>'{
15"amount":"20000",
16"currency":"NGN",
17"country":"NG",
18"mobileNumber":"08033456500", 
19"billingId":"PUBK_PjQ5d1578650322483", 
20"publicKey":"YOUR_PULIC_KEY", 
21"status":"INACTIVE"
22}',
23  CURLOPT_HTTPHEADER => array(
24    'Content-Type: application/json',
25    'Authorization: Bearer YOUR_ENCRYPTED_KEY'
26  ),
27));
28
29$response = curl_exec($curl);
30
31curl_close($curl);
32echo $response;
Response Sample
The code snippet below shows an example response for updating a subscription
1 "status": "SUCCESS",
2    "data": {
3      "subscriptions": {
4        "publicKey": "SBTEST**************************viTF", 
5        "amount": "20000",
6        "country": "NG",
7        "customerId": "ba981a0b7ed1c68ad245",
8        "cardName": "Jane Smith",
9        "cardNumber": "5123-45xx-xxxx-0008",
10        "plan": "80b0854b35a0e279efc3",
11        "status": "INACTIVE",
12        "billingId": "PUBK_PjQ5d1578650322483", 
13        "authorizationCode": "ddfce36aa4f3abc7cf72",
14        "startDate": "2020-10-01 10:58:25",
15        "createdAt": 1578650353000
16      },
17      "code": "00",
18      "message": "Successful"
19  }
Need something else?
If you have any questions or need general help, visit our support page
Signup for developer update
You can unsubscribe at any time. Read our privacy policy.