Callback function is only applicable to integration using the shopping cart method. The Callback for WooCommerce and OpenCart are now available.
A. Purpose
Callback URL is used as an alternative notification to the merchant shopping cart in case of a breakdown in the transaction flow. This function is only applicable to merchants who use the shopping cart method to integrate with senangPay. This method is optional so merchants can opt not to use this feature. However, it is recommended to use this feature to ensure data integrity between merchant’s systems and senangPay
B. Understanding the transaction flow of Callback URL
1. When a customer is doing a transaction using shopping cart, the customer will be redirected a few times to different systems.
2. If the transaction is approved by the bank but the customer encounters problems such as internet connection issues, there is a possibility that either:
- senangPay is updated with the correct transaction status but the merchant online store is not.
- Both senangPay and the merchant online store are not updated with the correct transaction status.
C. Solution when there is a breakdown in the transaction flow
1. Every transaction will go through a verification process in senangPay within 30 minutes to an hour after the initiation of the transaction. This buffer period is to ensure that the transaction has been completed and that the status is final in Visa/Mastercard/FPX.
2. In case of a transaction breakdown where senangPay and the online merchant store are not updated with the latest status, senangPay will do a callback to the merchant once the verification process is done and senangPay has been updated with the latest status.
3. In case of a transaction breakdown where senangPay is updated with the latest status but the merchant's online store is not, senangPay will do a callback immediately after the transaction is completed in senangPay.
4. If there is no breakdown in the transaction, senangPay will still do a callback to the online merchant store once the transaction is completed in senangPay.
D. Parameters
The callback process entails sending the same parameters as the one sent to the return URL. The callback URL must print out a simple ‘OK’ in HTML format without any HTML tags. The OK response is needed in order for the callback function to know if it has successfully sent the callback data.
E. Callback failure
1. If the merchant has configured the URL for callback but senangPay is unable to connect to the URL or the URL did not return ‘OK’, senangPay will send an email to the merchant. The merchant must fix the issue and update their system with the correct status for the transaction. If you do not want to receive any failure email notification, please set the callback response as ‘Ignore the response’. (refer to the next section for the location to set this). Take note that the callback URL must not be using a session.
2. Please avoid using redirection for callback URL. This might lead to HTTP status 302.
F. Method
senangPay will send the data to callback URL using the HTTP POST method.
G. Callback Frequency
1. The frequency varies depending on the situation. If the transaction is still pending, senangPay will start sending callbacks 5 minutes after the transaction starts. senangPay will send the callback in real-time once it receives any status update from the banks.
2. The last callback will be 1 hour after the transaction starts. This means you will receive multiple callbacks for the transactions.
3. It is also possible to receive a failed status followed by successful status. This is because the transaction was still not complete when senangPay made the initial query (for the status) with the banks.
4. The last callback will carry the final status of the transaction.
H. Where to set Callback URL?
1. Go to Menu > Settings > Profile
2. Scroll down the page and you will see the setting fields on "Shopping Cart Integration Link" section.
Please take note that:
- You might receive multiple callbacks for the same transaction. The latest callback data is considered the most up-to-date data for the transaction.