Skip to content

Shopee Pay

Topics covered on this page

Payment Flow

Mobile Flow

  1. Redirect user to Payment Page.
  2. Click Open "Shopee APP".
  3. Choose payment methon, then click "Pay Now"
  4. After Complete payment, Payment page will redirect user to return_url

Desktop Flow

  1. Redirect user to Payment Page.
  2. Scan QR with Shopee Pay application on Android or iOS.
  3. Choose payment methon, then click "Pay Now"
  4. After Complete payment, Payment page will redirect user to return_url

User Payment Flow

Implementation

  1. Create a new Charges using the service_id and api key provide by GUPAY
  2. Use redirect_url from Charges for send customer to payment page
  3. Charing result will send to Webhook and redirect user to return_url
  4. 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

POST

https://api.gupay.co/v1/charges

NameData TypeDescriptionExampleMandatory
Header parameter
AuthorizationstringAccess token to be passed as Basic tokenBasic {SECRET KEY}Y
content-typestringType of content as application/jsonapplication/jsonY
Body parameter
typestringType of paymentshopeepayY
service_idstringservice identifier. This ID will be provided by GUPay1234Y
amountintegerAmount of transaction. Must be positive number100Y
currencycurrencyCurrency for charge. use 3 letter follow ISO 4217 code.thbY
descriptionstringitem/credit detail provided by merchantPurchase 1000 GoldY
reference_idstringID to uniquely define each reqeust from partnerref_3Qc23iFf8UCGhKaKjgja6ynCvAVA6Y
customer_idstringID of your customer or user ID. It can be text, number or emailBud81@gmail.comY
flowstringType of payment flowredirectY
return_urlstringRedirect url for after user complete paymenthttps://merchant.redirect.com/resultN

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": "shopeepay",
"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

NameData TypeDescriptionExampleMandatory
Header parameter
content-typestringtype of content as application/jsonapplication/jsonY
Body parameter
idstringCharge unique identifier define each reqeust from GUPAYchg_klpr1MySQ0JxxxxxxY
objectstringThe String chargechargeY
merchant_idstringMerchant identifier. This ID will be provided by GUPayer_OkFBdWxxxxxxxxY
service_idstringservice identifier. This ID will be provided by GUPay1234Y
statusstringstatus of payment. one of successful , pending, failedpendingY
created_atdatetimeUTC datetime of create charge payment in format ISO 8601 (YYYY-MM-DDThh:mm:ssZ)2022-01-25T06:11:40ZY
updated_atdatetimeUTC datetime of update charge payment status in format ISO 8601 (YYYY-MM-DDThh:mm:ssZ)2022-01-25T06:11:40ZY
paidbooleanstatus charge has been capturedfalseY
amountintegerAmount of transaction. Must be positive number100Y
currencycurrencyCurrency for charge. use 3 letter follow ISO 4217 code.thbY
descriptionstringitem/credit detail provided by merchantPurchase 1000 GoldY
failure_codestringcode of failure status. please see more detail in Status Codeinsufficient_balanceY
failure_messagestringdetail of failure status. please see more detail in Status CodeUser's balance is not enough.Y
livemodebooleanstatus of live servicetrueY
merchant_reference_idstringID to uniquely define each reqeust from partnerref_3Qc23iFf8UCGhKaKjgja6ynCvAVA6Y
merchant_customer_idstringID of your customer or user ID. It can be text, number or emailBud81@gmail.comY
redirect_urlstringRedirect URL to payment pagehttps://gateway.gupay.co/shopeepay/payments/redirect/60c5c82a-e24d-4xxxxxxxxxxxxxxxY
return_urlstringRedirect URL after user payment provided by merchanthttps://merchant.redirect.com/resultN
paid_atdatetimeUTC datetime of charge payment in format ISO 8601 (YYYY-MM-DDThh:mm:ssZ)2022-01-25T06:11:40ZY
ipstringIP of payment charge requestffff:10.7.5.188N
flowstringtype of payment flowredirectN
typestringtype of paymentshopeepayY
payment_transaction_idstringpayment referent id provided by GUPay0bc28cbb-c3c1-429d-88b1-e997709435bcN
payment_reference_idstringpayment reference id from Payment Onwer10302358Y
mobile_numberstringmobile number of user0871492xxxxY
serial_nostringserial number of cashcard paymentN
pin_nostringpin number of cashcard paymentN

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/shopeepay/payments/redirect/60c5c82a-e24d-40cc-a2c0-dd7f312xxxxx",
    "return_url": "",
    "paid_at": null,
    "ip": "::ffff:10.7.5.xxx",
    "flow": "redirect",
    "type": "shopeepay",
    "payment_transaction_id": null,
    "payment_reference_id": null,
    "mobile_number": "",
    "serial_no": null,
    "pin_no": null
}

Limits

Minimum: 10 (10 THB)