Webhooks are an important part of your payment integration. They allow Etegram notify you about events that happen on your account, such as a successful payment or a failed transaction.
A webhook URL is an endpoint on your server where you can receive notifications about such events. When an event occurs, we'll make a POST request to that endpoint, with a JSON body containing the details about the event, including the type of event and the data associated with it.
Structure of a webhook payload`
All webhook payloads (except virtual card debits) follow the same basic structure:
- an event field describing the type of event
- a data object. The contents of this object will vary depending on the event, but typically it will contain details of the event, including:
i. an id containing the ID of the transaction
ii. a status, describing the status of the transaction
iii. payment or customer details, if applicable
Here is a sample webhook payloads for successful payment:
{ "event": "charge.completed", "data": { "id": "VVVMFDFKF34F", "tx_ref": "VMVMVV", "ete_ref": "OlumideOludowole/#LAoOyl4T%I6lyJ", "device_fingerprint": "N/A", "amount": null, "currency": "NGN", "charged_amount": 100, "app_fee": 11.4, "merchant_fee": 0, "ip": "105.113.14.184", "narration": "Bank Transfer", "status": "successful", "payment_type": "bank_transfer", "created_at": "2023-06-11T14:08:49.000Z" }, "customer": { "id": null, "name": "User", "phone_number": "09076553435", "email": "[email protected]", "created_at": null }, "meta": { "customer_id": "333", "customer_mac": "user_it" } }
Here are some sample webhook payloads for successful virtual Account payment: