Setup and Integration
Return URL Parameters
A. Support
1. Please take note that the return URL parameters are only required if you are using a system that requires return parameters that are different compared to the default parameters sent by senangPay.
2. For the list of default parameters sent by senangPay please refer here.
3. If your system is able to use the default parameters sent by senangPay then please leave the Return URL Parameters empty.
4. For users of senangPay WooCommerce and OpenCart plugin, please leave the field empty.
B. Purpose
1. Some systems require fixed parameters sent to them in order to integrate.
2. In this case senangPay will provide a way for merchants to specify the parameters that they would like to receive from senangPay.
3. The return URL parameters are also applied to callback URL.
C. What parameters are available
1. Below are the list of parameters that senangPay support :
Placeholder | Detail |
---|---|
[NAME] | This is the name of the payer as keyed in by the payer. |
[EMAIL] | The email of the payer as keyed in by the payer. |
[PHONE] | The phone number of the payer as keyed in by the payer. |
[AMOUNT] | The amount paid. |
[TXN_STATUS] | Transaction status: value 1 for successful and 0 for failed. |
[ORDER_ID] | The order id as sent by a third party system to identify the transaction. |
[TXN_REF] | The transaction reference number as generated by senangPay to uniquely identify the transaction. |
[MSG] | Message to describe the status of the transaction. |
[HASH] | Hashed value of the parameters using MD5. |
[TXN_TYPE] | Based on payment channel i.e fpx, cc, boost, tng, stripe , grabpay, shopeepay, shopback pay, grabpayLater & atome. |
D. How to check the hashed value sent by senangPay
1. The hashed value is based on the return URL parameters, which string (appended with merchant secret key) with the values with the exception of the hash.
2. Each parameter values needs to be URL encoded.
E. Example
1. For example, if your system requires the parameters named as below:
- email, example value: “[email protected]”
- amount_paid, example value: “10.50”
- txn_status, example value: “1”
- txn_msg, example value: “Payment was successful”
- order_id, example value: “A5463”
- hashed_value
2. Your merchant secret key is 123-456.
3. So you can key in the string below in the return URL parameters field.
?email=[EMAIL]&amount_paid=[AMOUNT]&txn_status=[TXN_STATUS]&txn_msg=[MSG]&order_id=[ORDER_ID]&hashed_value=[HASH]
4. To calculate the hash to verify the data you will need to md5 the string as below :
md5(123-456?email=john%40gmail.com&amount_paid=10.50&txn_status=1&txn_msg=Payment_was_successful&order_id=A5463&hashed_value=[HASH]);
the hash value generated will be 8e4d29818759e4069a635affdfc2572b.
OR
Generate the hash using HMAC hashing algorithm with SHA256 and get this hashed value:
hash_hmac(‘SHA256’, ‘123-456?email=john%40gmail.com&amount_paid=10.50&txn_status=1&txn_msg=Payment_was_successful&order_id=A5463&hashed_value=[HASH]’, ‘123-456’);
this will generate the hashed value 64c54bb8c1f1955ef6f4a8fc3d9f810d1490239d7e5dda82f030c2da6b99f0f6 .