Payment Notification Callback
Your client will be sent to the returnUrl
sent with your request if he has completed the payment at the generated cashierUrl
; if not, he will be redirected to cancelUrl
if he has chosen to cancel the payment. The payment processing details will be sent to you on the callbackUrl
that you submitted with your API request. Similar to what you would expect in response to a standard API request, a callback object is sent in JSON. The callback's body is shown below.
{
"transactionReference":583850021,
"orderReference":"WC-2023121846-71",
"merchantReference":1702916986358437,
"paymentMethod":"AmanCard"
,"amount":"510.00",
"currency":"EGP",
"status":"SUCCESS",
"createdAt":"2023-12-18 21:11:07",
"updatedAt":"2023-12-18 21:11:07",
"transactionType":"PayIn",
"transactionFees":"12.20",
"customerName":"customer name",
"customerPhoneNumber":"01234567890",
"customerEmail":"customer@mystore.com",
"customerAddress":"customer address",
"hmac":"409f3c5653f038bd822d969f984c1403dc03d0df843e55ef82205f70deb826730a7fd0a0c61be48c75bc488048227493d107c17560aaf857ef0197cea3621ae5"
}
Callback Parameters Description
Parameter | type | Description | |
---|---|---|---|
transactionReference | String |
Aman transaction number. | |
orderReference | String |
merchant order number. | |
merchantReference | String |
Aman merchant id. | |
paymentMethod | String |
Payment method (AmanCard ReferenceCode). | |
amount | String |
Transaction Amount in EGP. | |
currency | String |
Transaction currency. | |
status | String |
Transaction status (SUCCESS, Failed, etc...). | |
createdAt | String |
Transaction creation time. | |
updatedAt | String |
Transaction update time. | |
transactionType | String |
Transaction type. | |
transactionFees | String |
Transaction fees Amount in EGP. | |
customerName | String |
customer name. | |
customerPhoneNumber | String |
customer phone. | |
customerEmail | String |
customer email. | |
customerAddress | String |
customer address. | |
hmac | String |
HMAC SHA512 signature of the callback payload. Signed using your Secret Key. |
How To Create Hash Key To Check The Returned Response
{
generateHMAC($data, $key): string
{
$txt = sprintf(
"{Amount:\"%s\",Currency:\"%s\",TransactionReference:\"%s\",TransactionFees:\"%s\",TransactionType:\"%s\",OrderReference:\"%s\",PaymentMethod:\"%s\",Status:\"%s\",CreatedAt:\"%s\",UpdatedAt:\"%s\",MerchantReference:\"%s\",customerName:\"%s\",customerPhoneNumber:\"%s\",customerEmail:\"%s\",customerAddress:\"%s\"}",
$data['amount'],
$data['currency'],
$data['transactionReference'],
$data['transactionFees'],
$data['transactionType'],
$data['orderReference'],
$data['paymentMethod'],
$data['status'],
$data['createdAt'],
$data['updatedAt'],
$data['merchantReference'],
$data['customerName'],
$data['customerPhoneNumber'],
$data['customerEmail'],
$data['customerAddress']
);
return hash_hmac('sha3-512', ($txt), $key);
}
}