Skip to main content

WeChat in-APP Payments

WeChat APP Payment process-flow

HTTP Request

Endpoint : /trade/v1/payment

Method : POST

PayType : 800210

WeChat in-APP payments require a formal application on the WeChat Open Platform. Merchants have to register an account and the APP and then receive an appid to enable payments. For more information, please refer to the official Wechat documentation.

Optionally merchants can activate real-name authentication with WeChat. Currently real-name identification is only available for Mainland Chinese citizens and include a person's real name and national ID card number. In case identification is provided the payer's wallet information like a connected bank card must be identical with the data provided by merchants. If customers did not yet bind their WeChat account to a bank card the payment will go through regardless.

To download Wechat SDK please refer to this link.

Request Parameters


Request Body:

{
goods_info=test_app&goods_name=qfpay&out_trade_no=O5DNgEgL1XpvbvQSfPhN&pay_type=800210&txamt=10&txcurrcd=HKD&txdtm=2019-09-13 04:53:03&udid=AA
}

The above command returns JSON structured like this:

{
"sysdtm": "2019-09-13 12:53:04",
"paydtm": "2019-09-13 12:53:04",
"txcurrcd": "HKD",
"respmsg": "",
"pay_params":
{
"package": "Sign=WXPay",
"timestamp": 1568350384,
"sign": "XwFjohEKWdkhhT4ueg7BxeDn8tT9LcqoZYdXzifTMYyDGe3/tRchpii6vWgOn21tPSaAtqo766gvifXgDEOwR+ILKN8t97r624IJlrH0EkvSUSLh9E/cga9scXGVy0jPWHM/oVvVzJIvXew79CwZFCNTSJok2KmpSm9X9oPg7PGXbqvNMHltf+YlIOsuiz391qVmFtTE5A/cpA50+06T7iW8GYsOJQTTJed75VY+aSzNo5C6ju6WSgJKpAJJ0ocl+ONtmOp6GLVBSQXaMC4PitQcebcoP2J6fFgQ+YcPwHXasCYEnn4LaFN7zT/AjGg3E3gdCx3ksGNBOazYBRVz+g==",
"partnerid": "316525492",
"appid": "wx3c6896fa9b351f2a",
"prepayid": "wx131253044253463a81dc336e1254149882",
"noncestr": "7786db42d9a245c2b1cfc717ac59376e"
},
"pay_type": "800210",
"cardcd": "",
"udid": "AA",
"txdtm": "2019-09-13 04:53:03",
"txamt": "10",
"resperr": "交易成功",
"out_trade_no": "O5DNgEgL1XpvbvQSfPhN",
"syssn": "20190913152100020001567741",
"respcd": "0000",
"chnlsn": ""
}
AttributeMandatoryTypeDescription
mchidNoStringThe unique merchant ID is created by QFPay during the merchant onboarding process.
out_trade_noYesStringExternal transaction number
txamtYesStringThe actual amount of consumption, the maximum deduction amount cannot exceed the fozen funds. Suggest value > 200 to avoid risk control
txcurrcdYesString(3)Transaction currency. View the Currencies table for a complete list of available currencies
rmb_tagNoString(1)WeChat Pay in Hong Kong uses rmb_tag = Y together with txcurrcd = CNY to indicate that the transaction currency is RMB.
txdtmYesStringFormat: YYYY-MM-DD hh:mm:ss
udidNoStringDevice ID, must be unique
txzoneNoStringTime zone, used to record the local order time. The default is Beijing time GMT+8 (+0800)
return_urlNoStringRedirect URL, redirect to address after successful payment. Mandatory parameter to submit for GrabPay Online. Alipay WAP restricts the return_url to maximum 200 characters.
extend_infoNoObjectExtended Customer Info, real name customer identification. This parameter is currently only available for Mainland Chinese citizens and needs to be explicitly activated with WeChat for the selected PayType. The consumer's national ID card number is contained in the parameter user_creid and the payer's real name in encoded form or written in Chinese characters must be provided in user_truename. An example looks like this; extend_info = '{"user_creid":"430067798868676871","user_truename":"\\u5c0f\\u6797"}'

Response Parameters

AttributeTypeDescription
syssnString(40)QFPay transaction number, returned by the system once payment is completed
orig_syssnString(40)External transaction number
txdtmString(20)Transaction request time, format: YYYY-MM-DD hh:mm:ss
txamtInt(11)Transaction amount
sysdtmString(20)System transaction time, format: YYYY-MM-DD hh:mm:ss This parameter value is used as the cut-off time for settlements.
respcdString(4)Return code
respmsgString(128)Information description
resperrString(128)Description error
cardcdStringCard number
txcurrcdStringTransaction currency. View the Currencies table for a complete list of available currencies
pay_paramsObjectPayment data to call Wechat SDK