Appearance
Promptpay (QR Payment)
Topics covered on this page
Payment Flow
- Redirect User to QR Promptpay page.
- User Scan QR via Mobile banking appliaction.
- Confirm payment via Mobile banking appliaction..
- Customer is redirect back to your website via
return_url
Implementation
- Create a new Charges using the service_id and api key provide by GUPAY
- Use
redirect_url
from Charges for send customer to payment page - Charing result will send to Webhook and redirect user to
return_url
- Afer receiving the charge completion webhook event. retrieve the charge to verify its status(optional)
Create charges
When the customer confirms to use this payment method, create a new Charges specifying the amount
, currency
, type
https://api.gupay.co/v1/charges
Name | Data Type | Description | Example | Mandatory |
---|---|---|---|---|
Header parameter | ||||
Authorization | string | HTTP Basic Auth. Provide your secret key as the basic auth username value. You do not need to provide a password. | Basic {SECRET KEY} | Y |
content-type | string | Type of content as application/json | application/json | Y |
Body parameter | ||||
type | string | Type of payment promptpay | promptpay | Y |
service_id | string | service identifier. This ID will be provided by GUPay | 1234 | Y |
amount | integer | Amount of transaction. Must be positive number | 100 | Y |
currency | currency | Currency for charge. use 3 letter follow ISO 4217 code. | thb | Y |
description | string | item/credit detail provided by merchant | Purchase 1000 Gold | Y |
reference_id | string | ID to uniquely define each reqeust from partner | ref_3Qc23iFf8UCGhKaKjgja6ynCvAVA6 | Y |
customer_id | string | ID of your customer or user ID. It can be text, number or email | Bud81@gmail.com | Y |
flow | string | Type of payment flow | redirect | Y |
return_url | string | Redirect url for after user complete payment | https://merchant.redirect.com/result | N |
Example
Details
js
curl -X POST https://api.gupay.co/v1/charges
-H 'Authorization: Basic {{SECRET KEY}}'
-H 'cache-control: no-cache'
-H 'Content-Type: application/json'
-d '{
"type": "promptpay",
"service_id": "1234",
"amount": "100",
"currency": "thb",
"description": "Purchase 1000 Gold",
"reference_id": "ref_3423m9ZrFf4bfJcidKJFbEoxrdx",
"customer_id": "Gonzalo80",
"flow": "redirect",
"return_url": "https://merchant.redirect.com/result"
}'
Create Charge response and Webhook
Name | Data Type | Description | Example | Mandatory |
---|---|---|---|---|
Header parameter | ||||
content-type | string | type of content as application/json | application/json | Y |
Body parameter | ||||
id | string | Charge unique identifier define each reqeust from GUPAY | chg_klpr1MySQ0Jxxxxxx | Y |
object | string | The String charge | charge | Y |
merchant_id | string | Merchant identifier. This ID will be provided by GUPay | er_OkFBdWxxxxxxxx | Y |
service_id | string | service identifier. This ID will be provided by GUPay | 1234 | Y |
status | string | status of payment. one of successful , pending , failed | pending | Y |
created_at | datetime | UTC datetime of create charge payment in format ISO 8601 (YYYY-MM-DDThh:mm:ssZ ) | 2022-01-25T06:11:40Z | Y |
updated_at | datetime | UTC datetime of update charge payment status in format ISO 8601 (YYYY-MM-DDThh:mm:ssZ ) | 2022-01-25T06:11:40Z | Y |
paid | boolean | status charge has been captured | false | Y |
amount | integer | Amount of transaction. Must be positive number | 100 | Y |
currency | currency | Currency for charge. use 3 letter follow ISO 4217 code. | thb | Y |
description | string | item/credit detail provided by merchant | Purchase 1000 Gold | Y |
failure_code | string | code of failure status. please see more detail in Status Code | insufficient_balance | Y |
failure_message | string | detail of failure status. please see more detail in Status Code | User's balance is not enough. | Y |
livemode | boolean | status of live service | true | Y |
merchant_reference_id | string | ID to uniquely define each reqeust from partner | ref_3Qc23iFf8UCGhKaKjgja6ynCvAVA6 | Y |
merchant_customer_id | string | ID of your customer or user ID. It can be text, number or email | Bud81@gmail.com | Y |
redirect_url | string | Redirect URL to payment page | https://gateway.gupay.co/scb/form/60c5c82a-e24d-4xxxxxxxxxxxxxxx | Y |
return_url | string | Redirect URL after user payment provided by merchant | https://merchant.redirect.com/result | N |
paid_at | datetime | UTC datetime of charge payment in format ISO 8601 (YYYY-MM-DDThh:mm:ssZ ) | 2022-01-25T06:11:40Z | Y |
flow | string | type of payment flow | redirect | N |
type | string | type of payment | promptpay | Y |
payment_transaction_id | string | payment referent id provided by GUPay | 0bc28cbb-c3c1-429d-88b1-e997709435bc | N |
payment_reference_id | string | payment reference id from Payment Onwer | 10302358 | Y |
mobile_number | string | mobile number of user | 0871492xxxx | Y |
serial_no | string | serial number of cashcard payment | N | |
pin_no | string | pin number of cashcard payment | N |
Example
Details
js
{
"id": "chg_klpr1MySQxxxxx",
"object": "charge",
"merchant_id": "mer_OkFBdWwwsZYxxxxx",
"service_id": 1234,
"status": "pending",
"created_at": "2022-01-25T06:11:40Z",
"updated_at": "2022-01-25T06:11:40Z",
"paid": false,
"amount": 5,
"currency": "thb",
"description": "Purchase 1000 Gold",
"failure_code": null,
"failure_message": null,
"livemode": true,
"merchant_reference_id": "ref_1K4Tpk1YdWMYMHrmyyYci5Yjxxxxx",
"merchant_customer_id": "Stewart45@gmail.com",
"redirect_url": "https://gateway.gupay.co/scb/form/60c5c82a-e24d-40cc-a2c0-dd7f312xxxxx",
"return_url": "",
"paid_at": null,
"flow": "redirect",
"type": "promptpay",
"payment_transaction_id": null,
"payment_reference_id": null,
"mobile_number": "",
"serial_no": null,
"pin_no": null
}
Limits
Minimum: 10
(10 THB)
Caution
- QR Promptpay have timelimit at 90 second.
- If User Scan QR before timelimit runout and confirm payment after timeover this transaction can be successful.