Webhook Notification API Integration
GET PAY Webhook Notification API Integration
It enables Merchants to receive the status of the transactions that occurred on their GET PAY Accounts.
Webhook is an API concept that allows applications communicate between themselves automatically without polling.
Webhooks are used so that anytime an event occurs on your GET PAY account, your application or website can be notified with instant, real-time notifications by GET PAY.
The GET PAY webhooks are HTTP calls that are triggered by specific events. It is necessary only for behind-the-scenes transactions.
If you enable webhook notifications and set a webhook URL, GET PAY will send webhook events to notify updates, transfers, transactions, etc.
How to Set Up Webhook
This can be set up on your GET PAY Account by specifying a URL we would send POST requests to whenever a transaction occurs.
Webhook Validation (Securing your Webhook)
Anybody can send a webhook notification to your website or application. So you are to secure it by verifying the source of the webhook before taking action on the webhook data.
There are two ways to verify if a webhook notification is coming from GET PAY or not.
By Transaction Verification
Whenever GET PAY send a webhook Notification, The transaction referenceID you provided during the transaction and the GET PAY payment reference will be included in the payload sent to your webhook URL.You can now use either your referenceID or our paymentReference to verify the transaction using Transaction verification ENDPOINT.
By Signature Signature validationalidation
The webhook notification sent carries the Authencation parameter in the payload.The Authencation value (encrypted-body) is an HMAC SHA512 signature of the event payload signed using your secret key and GET PAY Payment reference.
So you can hash the payment Reference and your SecretKey puting a colon (:) in between, then Compare it with the Authencation value sent to your webhook.
Sample Function (PHP)
$seckey = "Sec23344444444";$paymentref = "unique111";
$passcode = "$seckey:$paymentref";
$authkey = hash('sha512', $passcode);
In the example above, the $authkey value is exactly what is sent in the Authencation body of the payload.
Sample Webhook for Bank Transfer To Virtual Accounts
{ data:{ "Authencation":"68393a01dfa456c8f7ee75faaa6a29d7c8b93b2a7b19bbe6e30af120ce7e1cae9055f9bc7ff8a80d47b2942ca07018b1156b7f6ffc398ecfcf5fbded693abeaf", "responseCode":"200", "status":"Completed", "service":"Money Transfer To Virtual Account", "referenceID":"unique111", "paymentReference":"GP99999", "businessID":"GP99999", "businessName":"GET PAY", "dateTime":"2023-11-16 08:43 PM", "message":"1000 Transferred Successfully To GET PAY MFB"}, paymentSource:{ "bankCode":"058", "bankName":"GTBank", "accountNumber":"2039276534", "amountPaid":"1000", "paymentMethod":"Virtual Account", "currency":"NGN", "sessionId":"17775656767", "paymentStatus":"Completed"} paymentDetails:{ "bankName":"GET PAY MFB", "accountNumber":"1010101010", "accountName":"GETPAY/Get Pay", "amountPaid":"1000", "charge":"10", "payable":"990", } customer:{ "firstName":"GET", "lastName":"PAY", "customerEmail":"get@gmail.com", "customerPhone":"08012345678", "accountReference":"accountref"} }
Sample Webhook for Card Transactions
{ data:{ "Authencation":"68393a01dfa456c8f7ee75faaa6a29d7c8b93b2a7b19bbe6e30af120ce7e1cae9055f9bc7ff8a80d47b2942ca07018b1156b7f6ffc398ecfcf5fbded693abeaf", "responseCode":"200", "status":"Completed", "service":"Money Transfer", "referenceID":"unique111", "paymentReference":"GP99999", "businessID":"GP99999", "businessName":"GET PAY", "dateTime":"2023-11-16 08:43 PM", "message":"1000 Transferred Successfully To GET PAY MFB"}, paymentSource:{ "amount":"1000", "amountPaid":"1010", "paymentMethod":"Card", "currency":"NGN", "cardType":"Visa", "sessionId":"17775656767", "paymentStatus":"Completed"} paymentDetails:{ "amountPaid":"1010", "charge":"10", "payable":"1000", } customer:{ "customerName":"GET PAY", "customerEmail":"get@gmail.com", "customerPhone":"08012345678", "redirectURL":"yourwebsite.com", "accountReference":"accountref"} }
Sample Webhook for Bank Transfer
{data:{ "Authencation":"68393a01dfa456c8f7ee75faaa6a29d7c8b93b2a7b19bbe6e30af120ce7e1cae9055f9bc7ff8a80d47b2942ca07018b1156b7f6ffc398ecfcf5fbded693abeaf", "responseCode":"200", "status":"Completed", "service":"Money Transfer", "dateTime":"2023-11-16 08:43 PM", "message":"1000 Transferred Successfully To GET PAY MFB"}, accounts:{ "bankCode":"215", "bankName":"GET PAY MFB", "accountNumber":"1010101010", "accountName":"GET PAY", "amount":"1000", "charge":"10", "payable":"990", "referenceID":"unique111", "paymentReference":"GETref1111"} }