Skip to main content

WeChat Pay H5 (in mobile browser)

WeChat H5 process-flow

HTTP Request

Endpoint : /trade/v1/payment

Method : POST

PayType : 800212

Request Parameters

AttributeMandatoryTypeDescription
Public payment parametersPlease refer to the Public Payment Section for more details
extend_infoYesObject
extend_info:
{
"scene_info":{ //场景类型
"h5_info": { // h5支付固定传"h5_info"
"type": "Wap", //场景类型
"wap_url": "https://qfpay.com/h5/pay", //WAP网站URL地址
"wap_name": "qfpay" //WAP 网站名
}
},
"spbill_create_ip": "192.168.1.10"// 用户真实ip地址获取指引 https://pay.weixin.qq.com/wiki/doc/api/H5.php?chapter=15_5
}

extend_info

AttributeSecondary AttributeThird AttributeMandatoryTypeDescription
scene_infoYesObject
h5_infoYesObject
typeYesStringscene type "Wap"
wap_urlYesStringmobile website address
wap_nameYesStringmobile website name
spbill_create_ipYesStringIP address of user

Response Parameters

AttributeSecondary AttributeTypeDescription
Public response parametersPlease refer to the Public Payment Section for more details
pay_urlYesString
warning

In normal process after payment, the user will return to the page where payment is initiated. If you want user to return to the specified page, you can insert redirect_url parameter to returned payment URL. For example, if you want user to jump to https://www.wechatpay.com.cn, it can be processed as follows:

pay_url

https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx20161110163838f231619da20804912345&package=1037687096

Payment URL after redirect_url inserted

https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx20161110163838f231619da20804912345&package=1037687096&redirect_url=https%3A%2F%2Fwww.wechatpay.com.cn