# Wechat JSAPI integration(mobile web)

This document is for adding wechat pay on web page, only when the page is in wechat browser.

# Request URL

Endpoint: https://api.iotpaycloud.com/v1/payForSubmit

Request method:

  • POST
  • Content-Type: application/x-www-form-urlencoded

# 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 3 letters representation for currency
qrcode_pay n int 1 set this param only in qrcode mode
channelId y String(24) WX_JSAPI see more channel id
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

Notice

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 qrcode_pay=1 in request

When code_url returned, merchant side should generate QR Code image based on code_url

# parameters passed to 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

# JSAPI web demo and source code

test page(please use wechat to open this page)click here

source code download

Last Updated: 9/22/2021, 4:32:22 PM