Get notified for every successful payment that occurs on your Aimtoget merchant account
What is a webhook? A webhook is an event triggered HTTP POST call notification.
Aimtoget will send you a webhook event that will notify your application of every successful payment that occurs on your account.
{ "status": true, "status_id": 102, "status_name": "Success", "reference_code": "e2437ab24b27affb", "amount": 100, "amount_formatted": "₦100", "date": "11th Sep 2018", "date_time": "2018-09-11 17:44:17", "email": "support@aimtoget.com", "phone": "+2349061668519", "description": "An aimtoget test payment", "channel": "Wallet", "metadata": { "referrer": { "name": "Referrer", "value": "https://aimtoget.com/product/pay-with-airtime" } } }
Creating a webhook endpoint on your server is no different from creating any page on your website.
$payload = @file_get_contents('php://input'); if(!$payload) { exit; } $data = json_decode($payload); if(!$data->data->status) { //payment failed here exit; } $reference = $data->data->reference_code; $amount = $data->data->amount; if($amount != $transaction_amount) { //transaction_amount is not equal to amount exit; } //Still do more checks to confirm if value has not been given. //Give value