Direct API

Information about the latest version of Direct API to set up direct payments.

 

Please note:
This feature is only available for Enterprise package users and restricted to authorised merchants only. Please contact us to whitelist your server's outgoing IP address.

What is Direct API?

Direct API is an advanced payment integration that allows you to streamline the checkout process by skipping the traditional payment form. With Direct API, customers can initiate payments directly from their preferred payment method without the need to fill out lengthy forms or provide additional information.

senangPay's Payment Direct v3 consists of two parts:

A. Client Session
B. Javascript Web SDK

 

email-graphic-05-1024x792

 

How to apply?

You may e-mail us at help@senangpay.my or call our support team.

How to enable this feature?

You can simply upgrade your package to the Enterprise package on your dashboard. Click here to learn how to upgrade your package.

Supported payment methods

  1. Credit cards
  2. FPX
  3. Boost
  4. Touch ‘n Go
  5. GrabPay
  6. ShopeePay

A. Client Session

API endpoint

Environment HTTP Method URL
Sandbox POST https://api.sandbox.senangpay.my/payment/v3
Production POST https://api.senangpay.my/payment/v3

 

Authorisation Header (Basic Auth):

Item Detail
username Merchant Id (from senangPay Dashboard)
password {leave blank}

4. Request parameters:

Parameter Data Type Compulsory? Example Details
payment_method string Yes fpx

Possible values:

fpx (online banking)
boost (Boost e-wallet)
tng (Touch n' Go e-wallet)
grabpay (GrabPay e-wallet)
grabpl (PayLater by Grab)
shopeepay (ShopeePay e-wallet)
shopback (Shopback e-wallet)
cc (Card payment)

fpx_bank_code

string compulsory if payment_method = ‘fpx 27 Refer to Appendix C
shopeepay_platform string compulsory if payment_method = 'shopeepay' mobile "desktop" or "mobile"
filter_card array optional for cc [1,2] Refer to Appendix B
customer_name string Yes Mohd Aiman Customer’s name
customer_email string Yes aiman@gmail.com Customer’s e-mail address
customer_phone string Yes 0193339922 Customer’s phone number
order_id string Yes payment_for_ID339112 Unique ID for this transaction for your reference
amount string Yes 200 Payment price multiply by 100 e.g:
RM 2.50 => 250
detail string Yes Payment for Order ID ID339112

Description of payment

hash     d9d7936bOf84262785ceff36207d7a7590b2b08696cef9643c9ffac1787e2882 Sha256 hash with the below string:
{secret key}{customer_name}{customer_email}
{customer_phone}{order_id}{amount}{detail} {payment_method}
Without the { } characters.

5. Response Parameters (JSON):

Item Detail
result 0 – failed
1 – successful create product
msg Error message description

payment_url

Url to proceed with payment
*use this url to access from your client side to proceed with payment*
*this url is valid only for 60 seconds*

B. Javascript Web SDK

Include these assets in your web page just below the <head> tag:

<link rel="stylesheet" href="https://senangpay.my/sdk/senangpay_v1.0.1.min.css">
<script src="https://senangpay.my/sdk/v1.0.1.min.js"></script>

Create this HTML element in the <body> tag:

<div id='senangpay_payment'></div>

Initiate senangPay class in Javascript:

***const senangpay = new Senangpay({merchantid});
senangpay.pay({uuid});***

Get the uuid from client session API in Part A response.
uuid is only valid for 60 seconds.
Get merchantid from your senangPay dashboard under Settings > Profile.

Appendix A

FPX Bank List API

1. Production: https://api.senangpay.my/fpx_bank_list

2. Sandbox: https://api.sandbox.senangpay.my/fpx_bank_list

3. Authorisation Header (Basic Auth):

Item Detail
username Merchant ID (from senangPay dashboard)
password {leave blank}

4. Request parameters :

Item Detail
fpx_bank_list Array with these properties:
1) fpx_bank_code (to be used in payment API)
2) name (Name of the bank)
3) status (active/inactive) *inactive means bank is offline*
4) type (b2b/b2c)
5) logo (logo of the bank)

 

Response parameters (JSON):

"fpx_bank_list": [

{
"fpx_bank_code": "22",
"name": "Affin Bank",
"status": "active",
"logo": "https://app.senangpay.my/public/images/bank/logo_affin.png", "type": "b2c"
},

{
"fpx_bank_code": "27",
"name": "Alliance Bank Malaysia Berhad",
"status": "active",
"logo": "https://app.senangpay.my/public/images/bank/logo_alliance.png", "type": "b2c"
},
]
}
 

Appendix B

Value Bank Issuer Card Type
1 Bank Kerjasama Rakyat

Credit Card

2 Bank Kerjasama Rakyat Debit Card
3 Maybank

Credit Card

4 Maybank Debit Card
5 CIMB

Credit Card

6 CIMB Debit Card

 

 

Appendix C

1. B2C FPX Payment

Bank fpx_bank_code
CIMB Bank Berhad 2
Bank Islam Malaysia Berhad 3
Hong Leong Bank Berhad 4
HSBC Bank Berhad 6
Malayan Banking Berhad (M2U) 7
Public Bank Berhad 9
RHB Bank Berhad 10
Ambank Berhad 13
United Overseas Bank Berhad 14
Kuwait Finance House 15
Bank Kerjasama Rakyat Malaysia 21
Affin Bank 22
OCBC Bank 23
Standard Chartered Bank 24
Bank Muamalat 25
Bank Simpanan Nasional 26
Alliance Bank Malaysia Berhad 27
Malayan Banking Berhad (M2E) 29

2. B2B FPX Payment

Bank fpx_bank_code
CIMB Bank Berhad 34
Bank Islam Malaysia Berhad 36
Hong Leong Bank Berhad 38
HSBC Bank Berhad 40
Public Bank Berhad 44
RHB Bank Berhad 46
Kuwait Finance House 52
Bank Kerjasama Rakyat Malaysia 54
OCBC Bank 58
Bank Simpanan Nasional 64
Malayan Banking Berhad (M2E) 68