Workflow for integrating Blinqpay Redirect
Blinqpay Redirect allows you to begin accepting payments simply by calling our initialize endpoint to initialize a transaction, and then routing your users to the gateway URL returned when initialization is successful. After successful payments on the gateway, clients are then re-routed to whatever URL you configured This method is further explained below.
A - Collect Client's Transaction Details
These are essential to initializing and tracking transactions, and are to be included in the payload passed to the endpoint
Parameter | Required | Details |
---|---|---|
amount | true | Transaction Amount (The amount to be paid by the customer) Minimum 100 Naira |
customerName | true | Customer's full name |
customerEmail | true | Customer's email |
phoneNumber | false | Customer's phone number |
paymentReference | true | A unique identifier for each transaction. An example is MST-8892A01 |
paymentDescription | false | A description of the transaction. Will be used as account name for pay with transfer Payment to Merchant BC |
currency | true | Currency for the transaction. Value should be NGN |
callbackUrl | true | URL to redirect Clients to, upon successful / failed / cancelled transactions |
deviceFingerprint | true | Unique device fingerprint |
incomeSplitConfig | false | object |
incomeSplitConfig.subAccountCode | true(if using split payment) | The unique reference identifying the sub account that should receive the split |
incomeSplitConfig.transactionChargeType | true(if using split payment) | The type of commission to charge for this transaction: FLAT or PERCENTAGE ("FLAT" if you want to get a flat fee while the subaccount gets the rest, or) "PERCENTAGE" if you want to get a percentage of the settlement amount |
incomeSplitConfig.transactionCharge | true(if using split payment) | The amount to charge as commission on the transaction. This should match with the transactionChargeType |
B - Initialize A Transaction
Make a post request to the endpoint below, and ensure that it carries the specified payload as shown.
Initialize Endpoint
https://api-sandbox.blinqpay.io/api/v1/initialize-transaction
Authorization: Bearer {YOUR_API_KEY}
NB: as noted earlier, the API key would be based off your transaction environment
{
"amount": 200,
"customerName": "First Last Name",
"customerEmail": "[email protected]",
"phoneNumber": "08030001212",
"paymentReference": "MST-8892A01Z",
"paymentDescription": "Nike Shoes",
"currency": "NGN",
"callbackUrl": "http://yourcallbackurl.com",
"deviceFingerPrint": "79e6b7f0b72037aa8428b70fbe03986c",
"incomeSplitConfig": [
{
"subAccountCode": "BLP_SUB_0C6QJEKW5ZB4M9ATPRDLO7GF2UYVNH3IZ",
"transactionChargeType": "PERCENTAGE",
"transactionCharge": 0.5
}
]
}
C - Route Clients to our Gateway
If the initialize endpoint has been called successfully, it returns a response with the following information:
{
"status": true,
"message": "success",
"data": {
"transactionReference": "BLQTEST-20224272156551200020797",
"paymentReference": "MST-8892A01Z",
"amount": 200,
"currency": "NGN",
"customerName": "First Last Name",
"customerEmail": "[email protected]",
"callbackUrl": "http://yourcallbackurl.com",
"checkoutUrl": "https://test-checkout.blinqpay.io/BLQTEST-20224272156551200020797",
"paymentDescription": "Nike Shoes",
"incomeSplitConfig": [
{
"subAccountCode": "BLP_SUB_0C6QJEKW5ZB4M9ATPRDLO7GF2UYVNH3I",
"transactionChargeType": "PERCENTAGE",
"transactionCharge": 0.5
}
]
}
}
You can then route users to the checkoutUrl to proceed, or the callbackUrl if they choose to cancel.
Keys To Note
checkoutUrl - Blinqpay's Gateway, with which clients can make payments using Debit Cards, Bank Transfer, and QR Code options.
callbackUrl - URL to which clients would be redirected after successful payments, or after cancelling the transaction.
Transaction Reference
The callbackUrl has an alpha-numeric transaction reference appended to it, and this should be used to verify payments after clients have been redirected back to your app.
D - Verifying Payment Upon Redirect
Upon returning to the callbackUrl, you are required to confirm the transaction status before giving value to the customer. This confirmation process is explained below:
Verify Endpoint
https://api-sandbox.blinqpay.io/api/v1/verify-transaction/{TRANSACTION_REF_APPENDED}
Make a get request to the above endpoint - which returns the payload response below. Then carry out actions based on the paymentStatus key. Note that value of paymentStatus is dynamic and dependent on the payment method used by the client.
{
"status": true,
"message": "Success",
"data": {
"createdAt": "2021-12-09T09:55:11.000000Z",
"amount": "500.0000",
"currencyCode": "NGN",
"customerName": "First Last Name",
"customerEmail": "[email protected]",
"paymentDescription": "Trial transaction",
"paymentStatus": "PAID",
"transactionReference": "BLQTEST-20211125854451906089208",
"paymentReference": "MST-4491A39",
"callbackUrl": "https://blinqpay.io/transaction/confirm/BLQTEST-20211125854451906089208"
}
}
For Card Payment, options for the paymentStatus are:
- SUCCESS
- PENDING
- FAILED
For Bank Transfer, options for the paymentStatus are:
- PAID - When the amount transferred by the client equals the expected amount
- PARTIALLY_PAID - Amount transferred is not up to the expected amount
- OVERPAID - Amount transferred is more than the expected amount
For QR Payment, options for the paymentStatus are:
- PAID
- FAILED
- PENDING