# Wechat mini program

This document is for wechat mini program integration. Note: the mini program must be owned by overseas company.

# Request URL

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

Request method:

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

# parameters

name required type sample description
mchId y String(30) 10000701 merchant id assigned by IOTPay
mchOrderNo y String(30) 20160427210604000490 order number in merchant system,need to be unique
channelId y String(24) WX_JSAPI channel id
currency y String(3) CAD 3 letters representation for currency
amount y int 100 payment amount,in cents,eg. $28.56 is 2856
clientIp y String(32) Client IP
device n String(64) WEB device identifier
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) IOTPay will send back the original value
param2 n String(64) IOTPay will send back the original value
extra y String(512) {"openId":"o2RvowBf7sOVJf8kJksUEMceaDqo", "type":"minipay","appId":"xxxxxxxxx"}
jobNo y String(50) merchant login name
remarks n String(200) remarks
sign y String(32) C380BEC2BFD727A4B6845133519F3AD6 signature

When merchant get the response from IOTPay API, pass the returned parameters to mini program. Mini program will call wx.requestPayment with these parameters.

    appId: res.data.payParams.appId,
    timeStamp: res.data.payParams.timeStamp,
    nonceStr: res.data.payParams.nonceStr,
    package: res.data.payParams.package,
    signType: res.data.payParams.signType,
    paySign: res.data.payParams.paySign,
    success(res) {
            url: '',
    fail(res) {
            url: '',

After payment,merchant backend server still need notifyUrl to judge whether the transaction is successful

# return fields

field require type sample description
retCode y String(16) SUCCESS SUCCESS/FAIL this field indicate communication result,not transaction.
need to check resCode to see whether transaction succeed
retMsg n String(128) signature error error message

# the following fields will return when retCode and resCode are both SUCCESS

name required type sample description
payOrderId y String payment order id
payParams y Array the parameters for mini program to call wx.requestPayment
sign y String signature

# error code

more error code

# sample code

sample code download

Last Updated: 11/25/2020, 2:00:25 PM