Create Payment Session
Last updated
Last updated
Partner and Merchant will use their own API credentials as usual.
Using the authentication parameter below:
username (Merchant API UID)
2aaa1633-e63f-4371-9b85-91d936aa56a1
password (Merchant API Auth Token)
ZyUfF8EmyabcMWPcaocX
To create a session. the merchant needs to use basic authentication
To send basic auth credentials with Curl, use the "-u login: password" command-line option. Curl automatically converts the login: password pair into a Base64-encoded string and adds the "Authorization: Basic [token]" header to the request. In this Curl request with Basic Auth Credentials example, we send a request with basic authorization credentials
curl https://securepay.my/echo -u "login:password"
Every partner will be issued one or more partner UID (partner_uid). SecurePay will identify partner accounts by using this identifier.
Please use POST method. The only compulsory parameter is the transaction_amount however merchants usually needs to supply order number in order to keep track record on their side. Your POST request will be returned in JSON format (later you can access payment_url)
Curl Request
curl -X POST https://sandbox.securepay.my/api/apis/payments -u 2aaa1633-e63f-4371-9b85-91d936aa56a1:ZyUfF8EmyabcMWPcaocX -d 'transaction_amount=200&order_number=231212&cancel_url=https://test.com'
Result
{"payment_url":"https://sandbox.securepay.my/api/apis/GSHJD1664332374/payment_session","data":{"buyer_name":null,"buyer_email":null,"buyer_phone":null,"transaction_amount":"200.00","order_number":"231212","product_description":"Payment for order no. 231212","slug":"GSHJD1664332374","callback_url":null,"redirect_url":null,"cancel_url":"https://test.com","timeout_url":null,"currency":"MYR","currency_amount":"200.00","partner_uid":null,"other_params":null,"created_at":"2022-09-28T10:32:54.087+08:00","updated_at":"2022-09-28T10:32:54.087+08:00"}
The payment form can be accessed through payment_url https://sandbox.securepay.my/api/apis/GSHJD1664332374/payment_session
Payment Form (https://sandbox.securepay.my/api/apis/GSHJD1664332374/payment_session)
Parameter
Description
Condition
Example
order_number
Unique order number generated by merchant end for reference.
Optional
20200425132755
buyer_name
Valid buyer full name in one line.
Optional
AHMAD AMSYAR MOHD ALI
buyer_email
Valid buyer email address for status update
Optional
amsyar@gmail.com
buyer_phone
Valid buyer phone number e.g: +60123121989
Optional
+60123121678
transaction_amount
Amount format: 100.20 , 1000.00, 7000.30
Compulsory
1540.40
product_description
Meaningful Product Description e.g.
Payment for order number 123
Payment for vintage table part #89782
Optional
Payment for order no 20200425132755
callback_url
Server to server. Securepay platform will post the payment status.
Optional
redirect_url
Browser to browser, Securepay platform will post to the endpoint browser.
Optional
partner_uid
Partner UID value
optional
c52853e0-24d6 .....
currency
SecurePay platform will convert the transaction amount into Malaysian Ringgit (RM/MYR). You need to pass the original currency value e.g: transaction_amount is 2 and currency is USD. So the conversion will be generated at the current rate e.g: 9.22 MYR. At this momment we only support USD.
optional
USD
cancel_url
SecurePay page for bank selection. If set the cancel URL. Button cancel will appear.
optional
e.g:
https://yourdom.com/securepay_cancel?order_number=123123
timeout_url
SecurePay page for bank selection. if set the timeout URL. The page will timeout within 3 minutes
optional
e.g:
https://yourdom.com/securepay_timeout?order_number=123123
Request
curl -X POST https://sandbox.securepay.my/api/apis/payments -u 2aaa1633-e63f-4371-9b85-91d936aa56a1:ZyUfF8EmyabcMWPcaocX -d 'transaction_amount=200&order_number=231213&cancel_url=https://test.com&buyer_name=Amir Haris&buyer_email=amir@test.com&buyer_phone=01239997978&callback_url=https://test.com/callback&redirect_url=https://test.com/redirect'
Result
{"payment_url":"https://sandbox.securepay.my/api/apis/RLIXQ1664333462/payment_session","data":{"buyer_name":"Amir Haris","buyer_email":"amir@test.com","buyer_phone":"01239997978","transaction_amount":"200.00","order_number":"231213","product_description":"Payment for order no. 231213","slug":"RLIXQ1664333462","callback_url":"https://test.com/callback","redirect_url":"https://test.com/redirect","cancel_url":"https://test.com","timeout_url":null,"currency":"MYR","currency_amount":"200.00","partner_uid":null,"other_params":null,"created_at":"2022-09-28T10:51:02.267+08:00","updated_at":"2022-09-28T10:51:02.267+08:00"}
Generated Payment Form (https://sandbox.securepay.my/api/apis/RLIXQ1664333462/payment_session)
Request
curl -X POST https://sandbox.securepay.my/api/apis/payments -u 2aaa1633-e63f-4371-9b85-91d936aa56a1:ZyUfF8EmyabcMWPcaocX -d 'transaction_amount=200&order_number=231214&cancel_url=https://test.com&buyer_name=Amir Haris&buyer_email=amir@test.com&buyer_phone=01239997978&callback_url=https://test.com/callback&redirect_url=https://test.com/redirect¤cy=USD&product_description=Electronic Picture Frame with order number 231214'
Result
{"payment_url":"https://sandbox.securepay.my/api/apis/MKJUP1664333854/payment_session","data":{"buyer_name":"Amir Haris","buyer_email":"amir@test.com","buyer_phone":"01239997978","transaction_amount":"922.15","order_number":"231214","product_description":"Electronic Picture Frame with order number 231214","slug":"MKJUP1664333854","callback_url":"https://test.com/callback","redirect_url":"https://test.com/redirect","cancel_url":"https://test.com","timeout_url":null,"currency":"USD","currency_amount":"200.00","partner_uid":null,"other_params":null,"created_at":"2022-09-28T10:57:34.874+08:00","updated_at":"2022-09-28T10:57:34.874+08:00"}
Generated Payment Form (
https://sandbox.securepay.my/api/apis/MKJUP1664333854/payment_session)