API Documentation
WeChat Pay - In-App Payment

Make use of "pay_info" returned from Payment API to invoke WeChat In-App Payment module via WeChat SDK in merchant's mobile app.

Request Parameters

URL: https://pay.ionlinepay.com/gateway/

Request Method: POST Form-Data

Name ID Required Type Description
API Name service Yes String(32) ionline.pay.weixin.inapp.intl
API Version version No String(8) Default value: 1.0
Charset charset No String(8) Default value: UTF-8
Signature Type sign_type No String(8) Default value: MD5
Merchant ID (MID) mch_id Yes String(32) Specifies Merchant ID assigned by iOnline Pay
Order Number out_trade_no Yes String(32) out_trade_no is an internal order number within the Vendor’s system.
Device ID device_info No String(32) Specifies the ID of the terminal device with from which the Merchant submitted their order
Item Description body Yes String(127) Item Description
Additional Data attach No String(127) Allow merchants an additional field to be returned in the payment notification after submitting a payment to the Query Order API
Total order amount total_fee Yes Int Specifies the total order amount. The units are expressed in cents as integers. The default currency is HKD.
WeChat Open Platform Mobile App ID (Approved) sub_appid Yes String(32) WeChat Open Platform Mobile App ID (Approved)
WeChat Open Platform Mobile App ID appid Yes String(32) WeChat Open Platform Mobile App ID
Terminal IP mch_create_ip Yes String(16) Specifies the machine IP that calls Payment API
Payment Notification URL notify_url Yes String(255) Specifies the callback URL for receiving payment notifications Support port 80 or 443 only
Return URL return_url No String(255) Specifies the return URL to redirect after completing payment
Transaction Start Time time_start No String(14) Specifies the transaction creation time in the format yyyyMMddHHmmss, such as 20170520094130 for May 20, 2017 09:41:30 (GMT+8).
Transaction End Time time_expire No String(14) Specifies the transaction end time in the format yyyyMMddHHmmss, such as 20170520094130 for May 20, 2017 09:41:30 (GMT+8).
* Both parameter "time_expire" and the parameter "time_start" must be passed in order to setup expiration time.
Merchant's Operator ID op_user_id No String(32) Merchant's Operator ID帳號,默認為商戶號
Item Label goods_tag No String(32) Specifies the label of goods, which is a parameter in the coupon feature for businesses.
Product ID product_id No String(32) This ID contains the product ID as set by the Merchant.
Random String nonce_str Yes String(32) 32 characters or fewer.
Prohibit Credit Card to Pay limit_credit_pay No String (32) If the value is 1, then WeChat Pay will block payer from paying by using credit card.
Signature sign Yes String(32) Signature Hash. For more information, see "Security Specification"

Response Parameters

Response Format: JSON

Name ID Required Type Description
API Version version Yes String(8) Default value: 1.0
Charset charset Yes String(8) Default value: UTF-8
Signature Type sign_type Yes String(8) Default value: MD5
Return Status Code status Yes String(16) This parameters indicates whether the API call is successful or not but this doesn't indicate to have a successful transaction.
If the value is 0, then it indicates sucecssful. Otherwise, it indicates failure.
Return Message message No String(128) The description of the Return Status Code if the value of parameter "status" is not 0.
The below parameters will be returned if the value of the parameter "status" is 0.
Service Result result_code Yes String(16) If the value is 0, then it indicates sucecssful. Otherwise, it indicates failure.
Merchant ID (MID) mch_id Yes String(32) Specifies Merchant ID assigned by iOnline Pay
Device ID device_info No String(32) Specifies the ID of the terminal device with from which the Merchant submitted their order
Random String nonce_str Yes String(32) 32 characters or fewer.
Error Code err_code No String(32) Error code
Error Message err_msg No String(128) The description of error code
Signature sign Yes String(32) Signature Hash. For more information, see "Security Specification"
The below parameters will be returned if the value of the both parameters "status" and "result_code" are 0.
Payment Data pay_info Yes String The value is a JSON string, which is passed as input parameters of the WeChat SDK to invoke In-App Payment.

Below is the sample data of "pay_info":
{"package":"Sign=WXPay","appid":"wx749a2607fb1111d8","sign":"EEA9A370FACEEFF2C0442F3FBDBDFD271688ED8AC4AD379656C7DCE5D39F5EA4","prepayid":"wx251349214863321f533582b41895666666","partnerid":"1593955555","noncestr":"13a7ba4942da437da04a8edc27055045","timestamp":"1590385761"} 

* Demo Code and WeChat SDK can be downloaded from WeChat Pay Official Website:
iOS / Android

* To see how it works, please refer to WeChat Pay Official Website:
iOS / Android