fbpx

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):

ItemDetail
username

< your-merchant-id >

As listed in the profile settings page.

passwordNone, leave empty.

4. Request parameters (All mandatory):

ItemDetail
tokenToken obtained from the 3D Get Token API
https://guide.senangpay.my/3d-get-token/
amountPre authorization amount.
Eg. if the amount is RM 2.00, you need to send 200.
detailPre authorization detail. Maximum length is 100.
Eg. Booking ID_4.
order_idYour pre authorization order ID. Can be number or string. Others character are invalid.
Eg. 1234ABC
hashA 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 :

ItemDetail
statusPre authorization status. 1 if success. 0 if failed.
order_idYour original pre authorization order ID.
preauth_idPre authorization ID. Will be used in the Pre Authorization – Capture API
amount_preauthAuthorized amount.
Eg. if the amount authorized is RM 2.00, it will output 200.
msgPre 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:
< your merchant id >< status_id >< order_id >< preauth_id >< amount_preauth >< msg >

*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):

ItemDetail
username

< your-merchant-id >

As listed in the profile settings page.

passwordNone, leave empty.

4. Request parameters (All mandatory):

ItemDetail
preauth_idPre 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 :

ItemDetail
statusCapture status. 1 if success. 0 if failed.
transaction_idYour transaction ID number.
amount_paidCaptured amount.
Eg. if the amount acptured is RM 2.00, it will output 200.
msgCapture 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_idYour 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