Secure payments via API Tokenization with verified cards

1.0 Pay credit card using token

ItemDetail

URL endpoint (POST)

https://app.senangpay.my/apiv1/pay_cc

Sandbox URL endpoint (POST)

https://app.senangpay.my/apiv1/pay_cc

1.1 Authorization Header (Basic Auth)

TypeBasic

Username

< your-merchant-id > As listed in the profile settings page.

Password

None, leave empty.

1.2 Request Parameter (All Mandatory)

Parameter Name

Parameter value/description

name

Your customer name. Maximum length is 100.

  • Example : Abu Bin Ali

email

Your customer email.

  • Example : ahmad@google.com

detail

Your order detail. Maximum length is 100.

  • Example : Order for product id #4

phone

Your customer phone number.

  • Example : 0109876543

order_id

Your order id. Can be number or string. Other character is invalid.

  • Example : 123

amount

Your order amount in integer format. Convert from decimals as necessary.

  • Example : if the amount is RM 2.00, you need to send 200.

token

Generated token from Get Token API

hash

A string generated using your secret key (found in your profile settings) with the HMAC SHA256 algorithm. The format is as follows: <your merchant id><name><email><phone><detail><order_id><amount> *Note: Do not include the < > characters.*

1.3 Response Parameter

Parameter Name

Parameter value / description

status

Your transaction status. 1 if successful. 0 if failed.

transaction_id

Your transaction ID number.

order_id

Your original order ID.

amount_paid

Amount transacted from the credit card in integer format.

  • Example : If the amount transacted is RM 2.00, it will output 200.

msg

Transaction status message. You'll receive "Payment was successful" for successful payments, or an error message if the transaction failed.

hash

A string generated using your secret key with HMAC SHA256. Format: <merchant_id><status_id><order_id> <transaction_id><amount_paid><msg> Exclude the < > characters.

1.4 Sample Response

{
   "status":1,
   "transaction_id":"14951544812820",
   "order_id":"1234",
   "amount_paid":1000,
   "msg":"Payment was successful",
   "hash":"99b6e99bb0aa663101b1e4f6f8d69c2efb41ef81a5a7aa030bf76a098a03d233"
}

** The "Test it" option is available when using Firefox or Safari to test the API

2.0 Enable/disable credit card

Item

Detail

URL endpoint (POST)

https://app.senangpay.my/apiv1/update_token_status

2.1 Authorization header (Basic Auth)

TypeBasic

Username

< your-merchant-id > As listed in the profile settings page.

Password

None, leave empty.

2.2 Request Parameter (All Mandatory)

Parameter NameParameter value / description

token

Generated token from Get Token API

2.3 Response Parameter

Parameter Name

Parameter value/description

msg

Message for the token is successfully disabled or enabled.

token

Generated token from Get Token API that has been disabled or enabled.

** The "Test it" option is available when using Firefox or Safari to test the API

3.0 Validate payment token

Item

Detail

URL endpoint (POST)

https://app.senangpay.my/apiv1/validate_token

3.1 Authorization header (Basic Auth)

TypeBasic

Username

< your-merchant-id > As listed in the profile settings page.

Password

None, leave empty.

3.2 Request Parameter (All Mandatory)

Parameter NameParameter value / description

token

Generated token from Get Token API

3.3 Response Parameter

Parameter Name

Parameter value/description

status

Token validation result.

  • 1 for success

  • 0 for failure.

msg

Message on token validation. "Card has been successfully verified" if successful, or an error message if not.

token

The token from the Get Token API, unchanged, showing whether it's enabled or disabled.

** The "Test it" option is available when using Firefox or Safari to test the API

Last updated