General Order API

General Order

Merchants can call General Order API to launch payment without diving into the details of how to integrate third party payment systems. IOTPay will handle third party API calls and respond to merchant according to the different channel.

An image

For in-App integration, Merchant App send payment request to IOTPay API server, then IOTPay API return the encrypted data to the Merchant App. With the encrypted dat, Merchant App can send them to Alipay/WeChat pay server via their corresponding SDK. Finally, IOTPay API server will notify merchant backend server when the transaction is successful.

An image

For detail of how to integrate in merchant app, please refer to app integration

API Request

Endpoint

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

Method

POST

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

Parameters

NameRequiredTypeSampleDescription
mchIdyString(30)10000701merchant id assigned by IOTPay
mchOrderNoyString(30)20160427210604000490order id assigned by merchant
need to be unique
channelIdyString(24)WX_NATIVEsee more channel id
currencyyString(3)CAD3 letter representation for currency,eg:CAD
amountyint100payment amount in cents,eg. $28.65 is 2865
clientIpyString(32)210.73.10.148client ip
devicenString(64)WEBdevice type(offline shop),use "WEB" when integrated on web
notifyUrlyString(200)http://xxx.com/notify.phpget notify when succeeded
subjectyString(64)test productproduct title
bodyyString(255)this product is for funproduct description
param1nString(64)can be ignored
param2nString(64)will return original value in notify
extrayString(512)WeChat mini program,WX_APP,WX_NATIVE need this
returnUrlnString(200)ALIPAY_PC,ALIPAY_WAP need thisredirect to this url after payment
jobNoyString(50)merchant login name
remarksnString(200)remarks
signyString(32)C380BEC2BFD727A4B6845133519F3AD6signature

Parameter Sample

params={"amount":1,"mchId":"10000000","mchOrderNo":"9af01329f1ec4c4694631b077a0e8573","subject":"product title","sign":"F64C43C1487C7C0DA93DA93DD2961FA2","body":"product desc","param1":"","param2":"","clientIp":"127.0.0.1","extra":"{\"openId\":\"osirq1MMdgrCw7ohNNV6JhwvDFO8\"}","notifyUrl":"http://ngrok.4jicao.com/goods/payNotify","currency":"CAD","device":"WEB","channelId":"WX_JSAPI"}

Extra Parameter

WeChat App Pay(WX_APP)
NameRequiredTypeSampleDescription
extrarequiredJSON{"type":"apppay","appId":"xxxxxxxxx"}
Mini Program(WX_JSAPI)
NameRequiredTypeSampleDescription
extrarequiredJSON{"openId":"o2RvowBf7sOVJf8kJksUEMceaDqo", "type":"minipay","appId":"xxxxxxxxx"}
Users use WeChat to scan Merchant's QR Code(WX_NATIVE)
NameRequiredTypeSampleDescription
extrarequiredJSON{"productId":"120989823"}productId is required
Extra Sample Data
"extra":"{\"cardType\":\"M\",\"cardNum\":\"XXXXXXXXXXXX1166\",\"expireDate\":\"1022\",\"emvLabel\":\"MASTERCARD\",\"emvAID\":\"A0000000041010\",\"emvTVR\":\"0000008000\",\"emvTSI\":\"0000\",\"emvTC\":\"ARQC: 3D36ACBD44BE512B\",\"termNum\":\"25957\",\"bankTermNum\":\"40880013\",\"termInvoiceNum\":\"724172\",\"seqNum\":\"000001000061\",\"authNum\":\"01046Z\",\"batchNum\":\"0008\",\"trxMethod\":\"T\",\"accountType\":\"\",\"receiptDisp\":\"000 Approved 00 Thank You\",\"cashbackAmount\":\"\",\"timeStamp\":\"20210120-19402057\",\"surchargeAmount\":\"\",\"langCode\":\"E\",\"trxDate\":\"01202021\",\"trxTime\":\"164033\",\"cvmResults\":\"1F0302\",\"trxCode\":\"00\"}"

Notice

Parameter mchOrderNo will be put into param1 when IOT Pay sends notify to the merchant's notifyUrl provided, please don't fill param1 when creating order.

After payment, Merchant's backend server still need notifyUrl to decide whether the transaction is successful

Return Result

NameRequiredTypeSampleDescription
retCodeyStringSUCCESSSUCCESS/FAIL retCode indicate communication status,
need to check resCode for transaction
retMsgnStringsignature failif not empty, it is error message
signyStringC380BEC2BFD727A4B6845133519F3AD6signature

channelId=ALIPAY_PC or ALIPAY_WAP or UPI_SEQ

NameRequiredTypeSampleDescription
payOrderIdyStringpayment order idorder id assigned by third party payment system
payUrlyStringmerchant need to redirect to this url, just echo payUrl to client or redirect to url in retParams
retParamsyArrayfor ALIPAY_WAP, merchant need to redirect to retParams.alipayUrl,for UPI_SEQ,redirect to retParams.unionpayUrl

channelId=ALIPAY_QR

NameRequiredTypeSampleDescription
payOrderIdyStringpayment order idorder id assigned by third party payment system
qr_codeyStringmerchant use this value to generate qr code for alipay scan

channelId=WX_NATIVE

NameRequiredTypeSampleDescription
payOrderIdyStringpayment order idorder id assigned by third party payment system
codeUrlyStringmerchant use this value to generate qr code for WeChat scan
prepayIdyStringprepayId is return from WeChat pay

channelId=CC_PAX

NameRequiredTypeSampleDescription
extrayString(json){"cardType":"M","cardNum":"XXXXXXXXXXXX1166","expireDate":"1022"}credit card transaction info

Demo and source code

general order demoopen in new window source code downloadopen in new window

merchant scan demoopen in new window source code downloadopen in new window

online signature checker demoopen in new window

Last Updated: