Virtual Account

This implementation contains endpoints to create a virtual account with First Bank of Nigeria to ensure end users can make payments into the created account.

👉

Please note that all endpoints are protected and require merchants to obtain an api-key which is to be passed as SHA-256 encoded string in the request header and a tag (merchantCode) field as a request param of the request being sent.

Making a GET request to the endpoint

https://testcollections.spaybusiness.com/api/v1/fbn/vaccount

With the following details as request params, all virtual accounts that has been created will be fetched

s/nPropertyData TypeExampleDescription
1merchantCodestring“TST_jaakdjfkadjfk”This will be gotten once user has successfully signed up on https://spaybusiness.com
2offsetint1Starting point of the record to be pulled, often encouraged to support pagination
3limitint20Needed to reduce the amount of data being pulled at a time
4tagstring“TST_jaakdjfkadjfk”This is the same as merchant code

Sample Response body with the status code of 200

{ 
  "content": [
    { "merchantCode": "TST_jaakdjfkadjfk", 
     	"reservationId": 10109, 
     	"accountName": "Jerrry", 
     	"virtualAccountName": "Spay Business Solutions LTD/Jerry", 
     	"virtualAccountNumber": "9100005726", 
     	"currency": "NGN", 
     	"batchId": "591920230721124528", 
     	"expiryDate": "2023-07-22T02:17:39.364Z", 
     	"phone": "08099387462", 
     	"email": "[email protected]",
			"accountState": "PENDING", 
     	"durationLimit": 2, 
     	"status": "CREATED", 
     	"charge": 2.390, 
     	"accountType": "Dynamic", 
     	"customerId": "086a7f80-5ee4-4938-b728-d92fb0136a29", 
     	"callbackUrl": "https://callingback.com", 
     	"createdOn": "2023-07-22T02:17:39.364Z" 
    }
  ],
  "count": 1, 
  "total": 1, 
  "last": true 
}

Making a POST request to the endpoint

https://testcollections.spaybusiness.com/api/v1/fbn/vaccount

With the following details as JSON BODY, a virtual account with First bank of Nigeria will be created.

s/nPropertyData typeExampleDescription
1accountNamestring"Jerry"This could be customer's name or merchant’s name
2merchantCodestring“TST_jaakdjfkadjfk”This will be gotten once user has successfully signed up on https://spaybusiness.com
3durationTypestringDAY or HOURTo state when the virtual account created will expire. These are the two types of duration type available for now
4accountTypeint1 or 2Static account = 1 and Dynamic account is 2. These are the two types of account type available for now
5expiryLimitint1 to 5States how long it will take the virtual account to expire. Saying durationType: DAY and expiryLimit: 2. This means account created will expire in two days
6emailstring[email protected]Customer email
7callbackUrlstringhttps://callingback.comThis is a dedicated url to be called when customer successfully made payment

Sample Response body with the status code of 200

{ 
  "merchantCode": "TST_jaakdjfkadjfk",
  "reservationId": 10003, 
  "accountName": "Jerry", 
  "virtualAccountName": "SPay Business Solutions Ltd/Jerry", 
  "virtualAccountNumber": "9100005721", 
  "currency": "NGN", 
  "batchId": "591920230720024529", 
  "expiryDate": "2023-07-26T00:00:00", 
  "phone": "08088492993", 
  "email": "[email protected]", 
  "accountState": "PENDING", 
  "durationLimit": 5, 
  "status": "CREATED", 
  "charge": 3.2300, 
  "accountType": "Dynamic", 
  "customerId": "086a7f80-5ee4-4938-b728-d92qw0136a50", 
  "callbackUrl": "https://callingback.com", 
  "createdOn": "2023-07-21T12:46:43.053237" 
}

Making a GET request to the endpoint

https://testcollections.spaybusiness.com/api/v1/fbn/vaccount/{reservationId}

Hitting this endpoint with merchantCode as query params and reservationId as path variable, this will fetch a previously created virtual account with First bank of Nigeria.

s/nPropertyData typeDescriptionExample
1reservationIdstringThis is the id gotten from the create virtual account leg10767
2merchantCodestring“TST_jaakdjfkadj fk”This will be gotten once user has successfully signed up on
https://spaybusiness.com
3tagstring“TST_jaakdjfkadj fk”This is the same as merchant code

Sample Response body with the status code of 200

{ 
  "merchantCode": "TST_jaakdjfkadjfk", 
  "reservationId": 10109, 
  "accountName": "Jerrry", 
  "virtualAccountName": "Spay Business Solutions LTD/Jerry", 
  "virtualAccountNumber": "9100005726", 
  "currency": "NGN", 
  "batchId": "591920230721124528", 
  "expiryDate": "2023-07-22T02:17:39.364Z", 
  "phone": "08099387462", 
  "email": "[email protected]", 
  "accountState": "PENDING", 
  "durationLimit": 2, 
  "status": "CREATED", 
  "charge": 2.390, 
  "accountType": "Dynamic", 
  "customerId": "086a7f80-5ee4-4938-b728-d92fb0136a29", 
  "callbackUrl": "https://callingback.com", 
  "createdOn": "2023-07-22T02:17:39.364Z" 
}