Pre Authorization APIs
A. Pre Authorization – Authorize (POST)
1. Production : https://app.senangpay.my/apiv1/preauth_by_token
2. Sandbox : https://sandbox.senangpay.my/apiv1/preauth_by_token
3. Authorization header (Basic Auth):
Item | Detail |
---|---|
username | < your-merchant-id > As listed in the profile settings page. |
password | None, leave empty. |
4. Request parameters (All mandatory):
Item | Detail |
---|---|
token | Token obtained from the 3D Get Token API https://guide.senangpay.my/3d-get-token/ |
amount | Pre authorization amount. Eg. if the amount is RM 2.00, you need to send 200. |
detail | Pre authorization detail. Maximum length is 100. Eg. Booking ID_4. |
order_id | Your pre authorization order ID. Can be number or string. Others character are invalid. Eg. 1234ABC |
hash | A string hashed with your secret key (from your profile setting page) in HMAC hashing algorithm with SHA256 in the following format: < your merchant id >< detail >< amount >*without the < > character |
5. Response Parameters :
Item | Detail |
---|---|
status | Pre authorization status. 1 if success. 0 if failed. |
order_id | Your original pre authorization order ID. |
preauth_id | Pre authorization ID. Will be used in the Pre Authorization – Capture API |
amount_preauth | Authorized amount. Eg. if the amount authorized is RM 2.00, it will output 200. |
msg | Pre authorization status message. If it was successful you will receive ‘Payment was successful’. If it’s failed, you will receive the error message in this parameter for further checking. |
hash | A string hashed with your secret key (from your profile setting page) in HMAC hashing algorithm with SHA256 in the following format: *without the < > character |
B. Pre Authorization – Capture (POST)
1. Production : https://app.senangpay.my/apiv1/preauth_by_token
2. Sandbox : https://sandbox.senangpay.my/apiv1/preauth_capture
3. Authorization header (Basic Auth):
Item | Detail |
---|---|
username | < your-merchant-id > As listed in the profile settings page. |
password | None, leave empty. |
4. Request parameters (All mandatory):
Item | Detail |
---|---|
preauth_id | Pre authorization ID from the Authorize API. |
hash | A string hashed with your secret key (from your profile setting page) in HMAC hashing algorithm with SHA256 in the following format: < your merchant id >< preauth_id > *without the < > character |
5. Response Parameters :
Item | Detail |
---|---|
status | Capture status. 1 if success. 0 if failed. |
transaction_id | Your transaction ID number. |
amount_paid | Captured amount. Eg. if the amount acptured is RM 2.00, it will output 200. |
msg | Capture status message. If it was successful you will receive ‘Payment was successful’. If it’s failed, you will receive the error message in this parameter for further checking. |
order_id | Your original pre authorization order ID. |
hash | A string hashed with your secret key (from your profile setting page) in HMAC hashing algorithm with SHA256 in the following format: < your merchant id >< status_id >< order_id >< transaction_id >< amount_paid >< msg > *without the < > character |