POS 半集成

IOT Pay 支持 POS(销售点)与信用卡支付终端进行集成,而无需担心支付卡行业数据安全标准 (PCI DSS)在新窗口打开问题。请联系 IOT Pay获取详细信息。

可使用统一下单接口

您可以使用统一下单接口的渠道: CC_PAX来接入此服务

API 请求

端点

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

方法

POST

头部

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

参数说明

变量名必填类型示例值描述
mchIdyString(30)10000701merchant id assigned by IOTPay
mchOrderNoyString(30)20160427210604000490order id assigned by merchant
need to be unique
channelIdyString(24)CC_PAXsee 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)POS9876device info
notifyUrlyString(200)http://localhostuse 'http://localhost' when channel='CC_PAX'
subjectyString(64)test productproduct title
bodyyString(255)this product is for funproduct description
extrayString(512)'CC_API'any string you want, not used now, but must have a value
jobNoyString(50)merchant login name
remarksnString(200)remarks
signyString(32)C380BEC2BFD727A4B6845133519F3AD6signature

参数示例

{
  "amount": "1",
  "body": "IOTPay",
  "channelId": "CC_PAX",
  "clientIp": "192.168.50.186",
  "currency": "CAD",
  "device": "V1-B25",
  "extra": "{\"pos_flag\":\"yes\",\"productId\":\"10000576_null\"}",
  "jobNo": "testpax",
  "mchId": "10000576",
  "mchOrderNo": "1632349674730",
  "notifyUrl": "http://localhost",
  "source": "pos_2.1.54",
  "subject": "IOTPay",
  "tip": "0",
  "sign": "AE51912B1FB627A1820BAF34DC89EF10"
}

返回结果

变量名必填类型示例值描述
retCodeyStringSUCCESSSUCCESS/FAIL
resCodeyStringSUCCESSSUCCESS/FAIL
retMsgnString'signature fail'only available when error occurs
signyStringC380BEC2BFD727A4B6845133519F3AD6signature
payOrderyJsonall information about this order

返回结果示例

{
  "resCode": "SUCCESS",
  "retCode": "SUCCESS",
  "retParams": "",
  "payOrderId": "CP20210922192314685200722249",
  "mchOrderNo": "1632338577033",
  "retDetail": "",
  "payOrder": {
    "userName": "testpax",
    "storeId": "ixm329sgr",
    "payOrderId": "CP20210922192314685200722249",
    "mchId": "10000576",
    "mchOrderNo": "1632338577033",
    "transId": "",
    "originalOrderId": "",
    "channelId": "CC_PAX",
    "currency": "CAD",
    "amount": 1,
    "tip": 0,
    "rate": 0,
    "payType": "pay",
    "refundable": 1,
    "clientIp": "192.168.50.186",
    "deviceId": "V1-B25",
    "deviceType": "",
    "notifyUrl": "http://localhost",
    "subject": "IOTPay",
    "body": "IOTPay",
    "param1": "",
    "param2": "",
    "extra": "{\"cardType\":\" \",\"cardNum\":\"\",\"expireDate\":\"    \",\"emvLabel\":\"\",\"emvAID\":\"\",\"emvTVR\":\"\",\"emvTSI\":\"\",\"emvTC\":\"\",\"termNum\":\"25957\",\"bankTermNum\":\"40880013\",\"termInvoiceNum\":\"167339\",\"seqNum\":\"000000000000\",\"authNum\":\"\",\"batchNum\":\"0000\",\"trxMethod\":\"\",\"accountType\":\"\",\"receiptDisp\":\"Transaction Not Completed 05\",\"cashbackAmount\":\"\",\"timeStamp\":\"20210922-15231494\",\"surchargeAmount\":\"\",\"langCode\":\"E\",\"trxDate\":\"\",\"trxTime\":\"\",\"cvmResults\":\"\",\"trxCode\":\"00\"}",
    "channelOrderNo": "",
    "status": 9,
    "remarks": "",
    "rateValue": 0,
    "trxAmount": 0,
    "costAmount": 0,
    "currencyAmount": 0,
    "paySuccTime": "",
    "createDate": 1632338594000,
    "updateDate": 1632338599000
  },
  "sign": "EA86BEEBE37C8C8F8A8E88C080D5E241"
}

从返回结果中获取订单状态

创建订单是一个同步 API,因此客户端将等待响应以获取订单状态。

if resCode == 'SUCCESS' and retCode == 'SUCCESS':
    if payOrder['status'] in (2,3):
        #order is paid successfully
    else
        #error occurs, get error message from extra['receiptDisp']
else:
    # error occurs before sending request to the bank

如果等待响应时超时了怎么办?

在少数情况下,如果客户端在等待响应时超时了,您可以每2秒初始化一个查询订单请求,持续一分钟。当您从响应中得到状态等于2或3时,你仍可以将此交易视为成功,并打印收据,然后停止订单查询的循环。

响应中'extra'变量里存储的信用卡交易信息

例:

"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\"}"

收据要求

对于与信用卡终端的半集成,收据的格式和内容有严格的规定。请联系IOT Pay获取规范和样本。

上次更新: