To ensure successful payment status response you need either
- Set a callback URL in your merchant dashboard OR
- Provide and return URL in the request for payment API call
Listening to The Callback
After calling request for payment API, edxaPay will return a status to notify the merchant if the transaction was successful, failed or canceled.
The callback API will receive the following data via POST or GET:
- transaction_id – unique transaction id registered in gateway
- payment_datetime – date and time of transaction
- amount – transaction amount
- order_no – order number passed by merchant in payment request
- status – transaction status (0 – pending, 1-successfull, 2-failed)
- status_msg – message of transaction status
- scode – MD5 hash in the following order
- channel_code – channel use to perform transaction
- fpx (online banking)
- cc (credit/debit card)
- tng (Touch N Go e-wallet)
- boost (Boost e-wallet)
- bank_name – extra parameter sent by edxaPay if channel_code is “FPX”, stating the bank name used for the transaction
Example of A Callback Listener
Below is an example to listen to a callback in PHP using POST. For GET just change the POST to GET function.
$status = $_POST['status']; $status_msg = $_POST['status_msg']; $channelcode = $_POST['channel_code']; $bank_name = $_POST['bank_name']; $transaction_id = $_POST['transaction_id']; $order_id = $_POST['order_no'];
Most of the time, the call back is instant after the customer make a transaction. All transaction e.g successful payment, cancel payment, insufficient fund will be notify to the callback URL immediately.
Do expect 1-2 seconds delay due to the internet.
We recommend your thank you, payment processing OR receipt page use a polling system at 5 seconds interval e.g AJAX to monitor the status of the callback.