Payment in WeChat Web Browser
This endpoint generates a link that enables WeChat pay in the WeChat Web Browser (WeChat JSAPI). Merchants can either send the link directly to customer or generate a QR code from the link for the customers to scan.
How it works
API Request
Endpoint
https://api.iotpaycloud.com/v1/payForSubmit
Method
POST
Header
Content-Type: application/x-www-form-urlencoded
! Tip
After you receive access credentials (merchant id, login name, merchant key). You can step through the demo Web Payment in WeChat Test to test out the workflow for this functionality. Which may help you when going through the documentation.
Note that the link must be opened in the WeChat browser for this function to work, you can copy the link to a chat window in the WeChat application, and open the link there.
Parameters
Name | Required | Type | Sample | Description |
---|---|---|---|---|
mchId | y | String(30) | 20001222 | merchant id assigned by IOTPay |
mchOrderNo | y | String(30) | 20160427210604000490 | order number in merchant system,need to be unique |
currency | y | String(3) | CAD | supported currency: CAD , USD , CNY |
QR code_pay | n | int | 1 | set this param only in QR code mode |
channelId | y | String(24) | WX_JSAPI | Fixed to WX_JSAPI |
amount | y | int | 100 | payment amount,in cents,eg. $28.56 is 2856 |
clientIp | y | String(32) | 210.73.10.148 | client ip |
returnUrl | y | String(200) | http://xxx.com/success.php | redirect url after payment |
notifyUrl | y | String(200) | http://xxx.com/notify.php | IOTPay will notify this url when payment success |
subject | y | String(64) | product id or title | product id or title |
body | y | String(255) | product description | product description |
param1 | n | String(64) | don't pass value in this field, will return mchOrderNo in notify | |
param2 | n | String(64) | will return original value in notify | |
extra | n | String(512) | ||
jobNo | y | String(50) | merchant login name | |
remarks | n | String(200) | remarks | |
sign | y | String(32) | C380BEC2BFD727A4B6845133519F3AD6 | signature |
Note
When get notify, parameter "mchOrderNo" will be put into "param1",let "param1" empty when sending request.
After payment,merchant backend server still need notifyUrl to judge whether the transaction is successful
Return Result
name | required | type | sample | description |
---|---|---|---|---|
retCode | y | String | SUCCESS | SUCCESS/FAIL retCode indicate communication status, need to check resCode for transaction |
url | y | String | if success=true, redirect to url | |
code_url | n | String | return only when QR code_pay=1 in request |
When code_url returned, merchant side should generate QR Code image based on code_url
Parameters of returnUrl
and notifyUrl
name | type | sample | description |
---|---|---|---|
payOrderId | String | order id of IOTPay | |
mchOrderNo | String | order id of merchant | |
channelOrderNo | String | order id of Alipay/WeChat Pay | |
status | Int | success code: 2 or 3 | |
amount | Int | in cents | |
param1 | String | ||
param2 | String |