Skip to main content

Payment Token

Payment Token is a generic API for merchants who want to integrate with Payment Gateway. The purpose of using this API is to request a payment token before the merchant can create a payment request via Redirect API

Payment Token Request

To prepare a payment token request, refer to the required parameters below.

Payment Token Request
{
"client_id": "shop1",
"client_secret": "myshopsecret",
"channel": "QRCODE",
"amount": 100,
"currency": "THB",
"invoice_no": "INV0001",
"ref1": "ref1",
"ref2": "reg2",
"remark": "reamrk",
"frontend_redirect_url": "https://yourdomain.com/payment-success",
"backend_callback_url": "https://yourdomain.com/api/payment-callback",
"locale": "th"
}
ParameterData TypeMandatoryDescription
client_idstringYesClient ID
client_secretstringYesClient Secret
channelstringYesPayment Channel
amountfloatYesPayment Amount
currencystringYesPayment Currency
invoice_nostringYesInvoice Number
ref1stringYesReference 1
ref2stringNoReference 2
remarkstringNoPayment Remark
frontend_redirect_urlstringNoFrontend Redirect URL
backend_callback_urlstringNoBackend Callback URL
localestringNo[th, en] default is th

cURL

cURL
curl -X 'POST' \
'http://uat-api-qr-pay.superrich1965.com/auth/getPaymentToken' \
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-d '{
"client_id": "shop1",
"client_secret": "myshopsecret",
"channel": "QRCODE",
"amount": 100,
"currency": "THB",
"invoice_no": "INV0001",
"ref1": "ref1",
"ref2": "reg2",
"remark": "reamrk",
"frontend_redirect_url": "https://yourdomain.com/payment-success",
"backend_callback_url": "https://yourdomain.com/api/payment-callback",
"locale": "th"
}'

Payment Token Response

To receive a payment token response, refer to the sample payment token response below.

Payment Token Response
{
"status": "success",
"access_token": "your-payment-token",
"expired_at": "2023-04-30T12:34:56Z",
"expires_in": 3600,
"web_redirect_url": "https://yourdomain.com/payment-success?token=your-payment-token"
}
ParameterData TypeMandatoryDescription
statusstringYesPayment Status
access_tokenstringYesPayment Token
expired_atstringYesExpired At
expires_innumberYesExpires In
web_redirect_urlstringYesWeb Redirect URL

Run test with Swagger Editor UAT

Run test with Swagger Editor Production