Webhook
Webhooks
This section contains the recommended flow for integrating BudPay Callback/Webhook services when using the BudPay RESTful API.
The webhook service enables BudPay to send your system an update on certain activities. Such activities will include:
- transaction
- virtual_account
- payout
Sample Transaction Webhook
{
"notify": "transaction",
"notifyType": "successful",
"data": {
"id": 1050471,
"currency": "USD",
"amount": "5.22",
"reference": "482208088163205800",
"ip_address": null,
"channel": "card",
"type": "transaction",
"domain": "live",
"fees": "0.19836",
"plan": null,
"requested_amount": "5.22",
"status": "success",
"card_attempt": 1,
"settlement_batchid": null,
"message": "Approved",
"metadata": "MID: DPPSPBDNG|15173|5399|CAPTURED|Approved|SUCCESS|520149xxxxxx1019|MASTERCARD|2022-08-08T12:59:17.516Z|2022-08-08|175714|USD|222012015173|13203834|UBAS3I01",
"created_at": "2022-08-08T12:58:09.000000Z",
"updated_at": "2022-08-08T12:59:23.000000Z",
"paid_at": "2022-08-08 13:59:23",
"customer": {
"id": 427351,
"first_name": null,
"last_name": null,
"email": "melasbah83@gmail.com",
"phone": null,
"domain": "live",
"customer_code": "CUS_6kj536tc0kx9brb",
"metadata": "{}",
"status": "active"
}
}
}
Sample Payout Webhook
{
"notify": "payout",
"notifyType": "successful",
"data": {
"id": 4552,
"reference": "BUD_trf_4fe1v.....",
"sessionid": "110021221004050251.....",
"currency": "NGN",
"amount": "500000",
"fee": "100",
"bank_code": "090405",
"bank_name": "Rolez Microfinance Bank",
"account_number": "0000222293",
"account_name": "Samuel Bud",
"narration": "my narration",
"domain": "live",
"status": "success",
"settled_by": null,
"subaccount": null,
"created_at": "2022-10-04T05:03:00.0000000000Z",
"updated_at": "2022-10-04T05:03:03.000000Z"
}
}
Sample Virtual Account Webhook
{
"notify": "transaction",
"notifyType": "successful",
"data": {
"id": 1050471,
"currency": "NGN",
"amount": "5.22",
"reference": "482208088163205800",
"ip_address": null,
"channel": "card",
"type": "dedicated_nuban",
"domain": "live",
"fees": "0.19836",
"plan": null,
"requested_amount": "5.22",
"status": "success",
"card_attempt": 0,
"settlement_batchid": null,
"message": "Approved",
"metadata": "MID: DPPSPBDNG|15173|5399|CAPTURED|Approved|SUCCESS|520149xxxxxx1019|MASTERCARD|2022-08-08T12:59:17.516Z|2022-08-08|175714|USD|222012015173|13203834|UBAS3I01",
"created_at": "2022-08-08T12:58:09.000000Z",
"updated_at": "2022-08-08T12:59:23.000000Z",
"paid_at": "2022-08-08 13:59:23",
"customer": {
"id": 427351,
"first_name": null,
"last_name": null,
"email": "melasbah83@gmail.com",
"phone": null,
"domain": "live",
"customer_code": "CUS_6kj536tc0kx9brb",
"metadata": "{}",
"status": "active"
}
}
}
Sample Successful BVN Verification Webhook
{
"notify": "bvn",
"notifyType": "successful",
"status": "00",
"reference": "20220540300003938",
"DOB": "No Match",
"Names": "Partial Match",
"Gender": "Exact Match",
"Phone_Number": "Exact Match",
"ID_Verification": "Partial Match",
"Verify_ID_Number": "Verified",
"Secondary_ID_Number": "Not Provided",
"Return_Personal_Info": "Not Applicable",
"ResultCode": "1021",
"ResultText": "Partial Match",
}
Webhook Signature Validation
This process is used to validate the autheticity of the webhook notification received from us
$sec = "YOUR_BUDPAY_SECRET_KEY";
$pub = "YOUR_BUDPAY_PUBLIC KEY";
$merchantsignature = hash_hmac("SHA512", $pub,$sec);
$webhooksignature = "THE MERCHANT SIGNATURE LOCATED IN THE HEADER OF THE WEBHOOK RECEIVED";
if($merchantsignature != $webhooksignature)
{
"DON’T HONOUR. IT IS A FRAUDULENT ATTEMPT";
}
if($merchantsignature == $webhooksignature)
{
"THE TRANSACTION WAS INITIATED BY YOU AND THUS BELONGS TO YOU";
}