# 1. Create Payment

# Request URL

  • {domain}/open-api/payment/generate

# Request Method

  • POST

# Request Header

Parameter Name Required Type Description
Content-Type Yes string application/json

# Request Body Param

Parameter Name Required Type Description
appId Yes string Application Id
param Yes string param
sign Yes string signature

# param

Parameter Name Required Type Length Example Description
timestamp Yes long - 1677495496979 Current timestamp
mchOrderId Yes string 1-32 CCP20220428011068111 Merchant order id (unique for transactionId) 1-32 characters
amount Yes long - - Payment amount (Unit is in cents, when the country is Indonesia, the unit is in yuan)
countryCode Yes string - - Country code (PH, ID, MY, TH, RU)
currency Yes string - - Currency (PHP, IDR, MYR, THB, RUB)
channelType Yes string - - Channel type (QR, ONLINE_BANKING, EWALLET, BANK_TRANSFER, CARD, DIRECT_DEBIT, PAYLATER)
channelCode Yes string - Reference list Channel code
payToken No string - - Pay token. require if channelType is DIRECT_DEBIT
customerName No string 1-128 - Payer's name. require if channelType is QR, ONLINE_BANKING, EWALLET, BANK_TRANSFER, CARD, PAYLATER
email No string 1-128 - Payer's email. require if channelType is QR, ONLINE_BANKING, EWALLET, BANK_TRANSFER, CARD, PAYLATER
mobile No string 10-14 - Payer's phone number. require if channelType is QR, ONLINE_BANKING, EWALLET, BANK_TRANSFER, CARD, PAYLATER
terminalType No string - - terminal type (WEB, WAP, APP), require if channelType is QR, ONLINE_BANKING, EWALLET, BANK_TRANSFER, CARD, PAYLATER
osType No string - - os type (IOS, ANDROID, OTHER)
notifyUrl Yes string 1-256 - Merchant transaction notification URL
redirectUrl No string 1-512 - Redirect URL. require if channelType is ONLINE_BANKING, EWALLET, CARD, PAYLATER
remark No string 1-256 - Remark
wechatpay No wechatpay - - params for wechatpay
goodsDetails No List<goodsDetail> - - Product information
require if channelType is PAYLATER.
Note: If this object is passed in, the inner required fields must also be provided.
billingAddress No billingAddress - - Billing address information
require if channelType is PAYLATER.
Note: If this object is passed in, the inner required fields must also be provided.

# wechatpay param

Parameter Name Required Type Length Example Description
payerClientIp No string 1-40 - - required when channelCode=TH_WECHAT_URL.
- the IP of the users' side device, which is the public network egress IP and supports IPV6
wpOpenid No string 1-128 - - required when channelCode=TH_WECHAT_JS_URL.
- the unique user ID corresponding to the appid of wechat platform.
- get WechatPay's Openid by Webpage Authorization
wpAppid No string 1-32 - - required when channelCode is in the list of [TH_WECHAT_JS_URL].
- APPID corresponding to the mobile app applied for on the WeChat Open Platform.
* When by Wechat Official account payment, please use appid of the merchant’s official account.
* When by Wechat Mini program payment, please use the appid of the merchant’s mini program.

# goodsDetail param

Parameter Name Required Type Length Limit Example Description
name Yes string 1-128 - Product name
price Yes long - - Product unit price (The total price of the product must match the payment amount)
quantity Yes integer 1-9999 - Product quantity
sku Yes string 1-64 - SKU ID (Unique ID assigned by the merchant to identify the product)
url No string 1-256 - Product URL. This is required when channelCode is ID_INDODANA_URL
category Yes string 1-64 - Product category. Reference values: airlines arts-crafts-and-collectibles automotive baby beauty-and-fragrances biller books-and-magazines business-to-business-including-mlm charity-and-non-profit clothing community digital-content electronics-and-telecom entertainment-and-media financial-services-and-products financial-services-and-technology food-and-beverage food-retail-and-service games-voucher gifts-and-flowers government health-and-personal-care home-and-garden hotel-and-travel insurance marketplace nonprofit offline-store others over-the-air overseas pets-and-animals property public-services religion-and-spirituality retail services sports-and-outdoors telco ticketing toys-and-hobbies transportation travel vehicle-sales vehicles-service-and-accessories fee offline
If no reference value is found, others can be used.

# billingAddress param

Parameter Name Required Type Length Limit Example Description
name Yes string 1-128 - Payer's name
address Yes string 1-512 - Payer's address
city Yes string 1-512 - Payer's city
state No string 1-512 - Payer's province
postalCode Yes string 5-10 - Payer's postal code
mobile Yes string 10-14 - Payer's phone number
countryCode Yes string 1-32 - Country code (Must match the country of the current channel type)

# Request Example

# Request Body

{
   "appId": "733b887a4a784708bb369524db5b6ded",
   "sign": "A5Vd8NcQvU3QT41Yee2jCIK58jDAKZ6kP5gEE4q7Yu92hUCY3k00FKTSlCNU+CcZm0LSrGbEMFMID3p7uvXaqy5khNv3kPndrgp7MIRHUmQnMgRK+g1XG7PzWdnrqlXc3g+L+kqVja+qrFRz+uVS6GLKLR1P4AtgTa9dok6NU7YTWOnG9r/FwIVx/At4czfEpI10pvg2TptVpiANmseGmz4G30hkaYTTNahkcOMQJn6PDFjivHvjNLZNJVOqHQzVUa+kca1yZZMPHtgxR647KjoY2oAjjl0Y45GL6zP9qHD/eVwcPPAPrRZ4K2o05OJnPf67fAcWNVqpnu6ZGQIXhQ==",
   "param": "{\"timestamp\":1715595802,\"mchOrderId\":\"10e5595801938341100\",\"currency\":\"PHP\",\"countryCode\":\"PH\",\"channelType\":null,\"channelCode\":\"PH_QRPH_DYNAMIC\",\"customerName\":\"name\",\"email\":\"test@email.com\",\"mobile\":\"09123456789\",\"amount\":10000,\"remark\":\"remark\",\"notifyUrl\":\"https://www.test.com\",\"redirectUrl\":\"https://www.test.com\",\"terminalType\":\"WEB\"}"
}

TH_WECHAT_URL

{
   "appId": "733b887a4a784708bb369524db5b6ded",
   "sign": "A5Vd8NcQvU3QT41Yee2jCIK58jDAKZ6kP5gEE4q7Yu92hUCY3k00FKTSlCNU+CcZm0LSrGbEMFMID3p7uvXaqy5khNv3kPndrgp7MIRHUmQnMgRK+g1XG7PzWdnrqlXc3g+L+kqVja+qrFRz+uVS6GLKLR1P4AtgTa9dok6NU7YTWOnG9r/FwIVx/At4czfEpI10pvg2TptVpiANmseGmz4G30hkaYTTNahkcOMQJn6PDFjivHvjNLZNJVOqHQzVUa+kca1yZZMPHtgxR647KjoY2oAjjl0Y45GL6zP9qHD/eVwcPPAPrRZ4K2o05OJnPf67fAcWNVqpnu6ZGQIXhQ==",
   "param": "{\"timestamp\":1715595802,\"mchOrderId\":\"10e5595801938341100\",\"currency\":\"THB\",\"countryCode\":\"TH\",\"channelType\":\"EWALLET\",\"channelCode\":\"TH_WECHAT_URL\",\"customerName\":\"name\",\"email\":\"test@email.com\",\"mobile\":\"0912345678\",\"amount\":10000,\"remark\":\"remark\",\"notifyUrl\":\"https://www.test.com\",\"redirectUrl\":\"https://www.test.com\",\"terminalType\":\"WEB\",\"wechatpay\": {\"payerClientIp\": \"1.1.1.1\"}}"
}

TH_WECHAT_JS_URL

{
  "appId": "733b887a4a784708bb369524db5b6ded",
  "sign": "A5Vd8NcQvU3QT41Yee2jCIK58jDAKZ6kP5gEE4q7Yu92hUCY3k00FKTSlCNU+CcZm0LSrGbEMFMID3p7uvXaqy5khNv3kPndrgp7MIRHUmQnMgRK+g1XG7PzWdnrqlXc3g+L+kqVja+qrFRz+uVS6GLKLR1P4AtgTa9dok6NU7YTWOnG9r/FwIVx/At4czfEpI10pvg2TptVpiANmseGmz4G30hkaYTTNahkcOMQJn6PDFjivHvjNLZNJVOqHQzVUa+kca1yZZMPHtgxR647KjoY2oAjjl0Y45GL6zP9qHD/eVwcPPAPrRZ4K2o05OJnPf67fAcWNVqpnu6ZGQIXhQ==",
  "param": "{\"timestamp\":1715595802,\"mchOrderId\":\"10e5595801938341100\",\"currency\":\"THB\",\"countryCode\":\"TH\",\"channelType\":\"EWALLET\",\"channelCode\":\"TH_WECHAT_URL\",\"customerName\":\"name\",\"email\":\"test@email.com\",\"mobile\":\"0912345678\",\"amount\":10000,\"remark\":\"remark\",\"notifyUrl\":\"https://www.test.com\",\"redirectUrl\":\"https://www.test.com\",\"terminalType\":\"WEB\",\"wechatpay\": {\"wpOpenid\": \"xxxx\", \"wpAppid\": \"yyyy\"}}"
}

How to construct request body

# Response Param

Parameter Name Type Description
code integer response code
message string response message
data Object data

# data

Parameter Name Type Description
mchOrderId string Merchant order id
transactionId string Platform transaction id
transactionStatus String Transaction status(PENDING , COMPLETED, FAILED
payData string Payment data(VA,URL or QR Content)
channelType string Channel type
channelCode string Channel Code
cashierUrl string Cashier Url
metadata object metadata
metadata.wechatpay object metadata of wechatpay, which is used to call payment
metadata.wechatpay.prepayId string Prepayment session ID generated by WeChat
metadata.wechatpay.appId string Appid of merchant's wechat official account/mini program/app
metadata.wechatpay.nonceStr string Random string
metadata.wechatpay.pkg string An extension string for order details
metadata.wechatpay.paySign string Signature
metadata.wechatpay.signType string Signature Method
metadata.wechatpay.timeStamp string Timestamp

# Response Example

{
  "code": 10000,
  "message": "Success",
  "data": {
    "mchOrderId": "10e051066810618100",
    "transactionId": "CU510579106014826496",
    "transactionStatus": "PENDING",
    "payData": "00020101021128760011ph.ppmi.p2m0111OPDVPHM1XXX03157771480000000170416529481372394713405030005204601653036085802PH5908PayCools6015City Of Mandalu62310010ph.allbank05062110000803***88310012ph.ppmi.qrph0111OPDVPHM1XXX630476F2",
    "channelType": "QR",
    "channelCode": "PH_QRPH_DYNAMIC"
  }
}

TH_WECHAT_URL

{
    "code": 10000,
    "message": "Success",
    "data": {
        "mchOrderId": "test1729221472807",
        "transactionId": "CU547114851101577216",
        "transactionStatus": "PENDING",
        "payData": "https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wxtest202410187232209353610467317753&package=4490330157&redirect_url=https%3A%2F%2Fwww.test.com",
        "channelType": "EWALLET",
        "channelCode": "TH_WECHAT_URL"
    }
}

TH_WECHAT_JS_URL

{
  "code": 10000,
  "message": "Success",
  "data": {
    "mchOrderId": "test1729223118645",
    "transactionId": "CU547121754175180800",
    "transactionStatus": "PENDING",
    "payData": "https://bluepaycashier.upay365.xyz/payment/wechat/inner/rh0lTZoN3JDyPUlKQv9-iQ==?redirect_url=https://www.test.com",
    "channelType": "EWALLET",
    "channelCode": "TH_WECHAT_JS_URL",
    "metadata": {
      "wechatpay": {
        "prepayId": "wxtest202410187110737194525930233806",
        "appId": "YYY",
        "nonceStr": "yUFOPwEFX9ZK0Sc7mZBfzIlnR0tzAz7Y",
        "pkg": "prepay_id=wxtest202410187110737194525930233806",
        "paySign": "hTm4NhjeT7MM3qbeO8CFkhVxbSgk5SeOB8M/5AY8CuogH5hl9TWE1xVP3R9ZjhSZ/9bfziQKRTYL/rp+FjZ1TUGqqANbL9IDDy5V2ITjP/Gczf+kOM+hMM8HYBTe67BCJREOmKIWya4vN7l7nLQnB0tM7+bCujoxKjXDmittnUD6ECQh5zm/0FtJUNtT7a4o0H350pp/SjNIaNAXbZ8hP+aBBRRdquL6Sz9BCZe1A0fwO9ufBll2vvOOfa0zvXt1jR2DIsCDWA4icw1Vvf2lhadPYo3tNDqA5I3qebCGGcXLudyw4c5XVR/I5gpnR7YndGd16i56uODM0yBAnLGiMg==",
        "signType": "RSA",
        "timeStamp": "1729223119"
      }
    }
  }
}

Code Collection

# Failed Response Example

{
    "code":21016,
    "message":"Merchant ip forbidden"
}