Skip to content

Charge API

To charge with payment channel of gupay. You create a Charges. you can individual charges.

Topics covered on this page

Create Charges POST

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

Create a new charges for get a charges redirect url.

NameData TypeDescriptionExampleMandatory
Header parameter
AuthorizationstringHTTP Basic Auth. Provide your secret key as the basic auth username value. You do not need to provide a password.Basic {SECRET KEY base64-encoded}Y
content-typestringtype of content as application/jsonapplication/jsonY
Body parameter
typestringType of paymenttruemoneywalletY
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": "truemoneywallet",
"service_id": "1234",
"amount": "100",
"currency": "thb",
"description": "ขำระการสั่งซื้อ gold",
"reference_id": "ref_3423m9ZrFf4bfJcidKJFbEoxrdx",
"customer_id": "Gonzalo80",
"flow": "redirect",
"return_url": "https://merchant.redirect.com/result"
}'

Create Charges Result

Attributes

NameData TypeDescriptionExampleMandatory
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 merchantขำระการสั่งซื้อ 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/payment_urlY
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
flowstringtype of payment flowredirectN
typestringtype of paymenttruemoneywalletY
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": "ขำระการสั่งซื้อ 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/truemoneywallet/form/60c5c82a-e24d-40cc-a2c0-dd7f312xxxxx",
    "return_url": "",
    "paid_at": null,
    "flow": "redirect",
    "type": "truemoneywallet",
    "payment_transaction_id": null,
    "payment_reference_id": null,
    "mobile_number": "",
    "serial_no": null,
    "pin_no": null
}