Skip to main content

How to integrate


1. Prepare 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

2. Receive 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

3. Redirect to Payment Page

Redirect to payment page via browser. The payment page URL is returned in the Parameter "web_redirect_url".

demo

4. Receive Payment Response via backend API

The parameter "backend_callback_url" that was previously sent via Payment Token Request is the merchant endpoint that will receive the backend notification. If the parameter "backend_callback_url" is not set, the system will obtain the backend return URL from the merchant profile set in Superrich QR Pay's merchant portal by default.

Back End Payment Response
{
"id": 1,
"company_id": 1,
"client_id": 1,
"channel": "QRCODE",
"amount": 100,
"currency": "THB",
"invoice_no": "INV0001",
"reference1": "ref1",
"reference2": "reg2",
"remark": "reamrk",
"trx_id": "1233123",
"canceled_at": "2023-04-30T12:34:56Z",
"canceled_reason": "canceled_reason",
"status": "COMPLETED",
"created_at": "2023-04-30T12:34:56Z",
"expired_at": "2023-04-30T12:34:56Z",
"completed_at": "2023-04-30T12:34:56Z"
}
ParameterData TypeMandatoryDescription
idnumberYesPayment ID
company_idnumberYesCompany ID
client_idnumberYesClient ID
channelstringYesPayment Channel
amountnumberYesPayment Amount
currencystringYesPayment Currency
invoice_nostringYesInvoice Number
reference1stringYesReference 1
reference2stringYesReference 2
remarkstringYesPayment Remark
trx_idstringYesTransaction ID
canceled_atstringYesCanceled At
canceled_reasonstringYesCanceled Reason
statusstringYesPayment Status
created_atstringYesCreated At
expired_atstringYesExpired At
completed_atstringYesCompleted At

5. Receive Payment Response via browser redirection

Fill in the parameter "frontend_redirect_url" with the merchant page that you wish to redirect to. If the parameter "frontend_redirect_url" is not set, the system will obtain the front end return url from the merchant profile set in Superrich QR Pay's merchant portal by default. Refer to the sample response returned below.

Front End Payment Response
{
"status": "COMPLETED",
"payment_token": "your-payment-token",
"invoice_no": "INV0001"
}
ParameterData TypeMandatoryDescription
statusstringYesPayment Status
payment_tokenstringYesPayment Token
invoice_nostringYesInvoice Number