Payment Token
- UAT URL
- Production URL
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"
}
| Parameter | Data Type | Mandatory | Description |
|---|---|---|---|
| client_id | string | Yes | Client ID |
| client_secret | string | Yes | Client Secret |
| channel | string | Yes | Payment Channel |
| amount | float | Yes | Payment Amount |
| currency | string | Yes | Payment Currency |
| invoice_no | string | Yes | Invoice Number |
| ref1 | string | Yes | Reference 1 |
| ref2 | string | No | Reference 2 |
| remark | string | No | Payment Remark |
| frontend_redirect_url | string | No | Frontend Redirect URL |
| backend_callback_url | string | No | Backend Callback URL |
| locale | string | No | [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"
}
| Parameter | Data Type | Mandatory | Description |
|---|---|---|---|
| status | string | Yes | Payment Status |
| access_token | string | Yes | Payment Token |
| expired_at | string | Yes | Expired At |
| expires_in | number | Yes | Expires In |
| web_redirect_url | string | Yes | Web Redirect URL |
Run test with Swagger Editor UAT
Run test with Swagger Editor Production