請求路徑 : api/pay/cashierOrder

請求方式 : POST

請求類型 : application/json or application/x-www-form-urlencoded

請求參數

參數描述範例
mchNo必填.商家編號,在管理後台可查看。M1621873433953
appId必填.在管理後台可查看。60cc09bce4b0f1c0b83761c9
mchOrderNo必填。商家產生的訂單號碼。20160427210604000490
amount必填.付款金額,单位:分 注意只支持2位精度,乘以100后使用Integer類型。100
currency必填。三位數貨幣代碼cny
reqTime必填。請求API時間,13位時間戳。1622016572190
registerTime必填.客戶註冊時間(V1.1.0新增)1622016572190
custNo必填.客戶唯一編號(V1.1.0新增)C200492312
version必填 版本號,當前接口支持最低版本為:1.11.1
signType必填。簽名類型,目前僅支援MD5方式。MD5
sign必填。簽名值,詳細請參考請求簽名。C380BEC2BFD727A4B6845133519F3AD6
wayCode保留字段,不用传值。指定付款方式,即在收銀台不展示其他支付方式。 支付方式列表 。注意如果開通了專屬收銀檯,必須開通ALI_WAP或ALI_JSAPI支付方式。
subject產品標題(保留欄位,當前版本不要傳值。)商品
body產品描述(保留欄位,當前版本不要傳值。)0
userName發起付款的用戶真實姓名。張三
mbrTel 發起付款用戶的手機號碼13812341234
idNo發起付款用戶的身份證號碼320681198603213312
notifyUrl支付結果回調通知URL,只有傳入該值才會啟動通知https://www.yourserver.com/notify.htm
returnUrl支付完成後跳轉URLhttps://www.yourserver.com/return.htm
expiredTime訂單過期時間,單位秒。不傳或小於15分鐘將設置為15分鐘。3600
extParam商家擴充參數,回調時原樣返回134586944573118714

請求範例:

{
  "amount": 8,
  "extParam": "",
  "mchOrderNo": "mho1624005107281",
  "sign": "84F606FA25A6EC4783BECC08D4FDC681",
  "reqTime": "1624005107",
  "version": "1.0",
  "channelExtra": "{\"authCode\":\"280812820366966512\"}",
  "appId": "60cc09bce4b0f1c0b83761c9",
  "notifyUrl": "https://www.paypass.com",
  "signType": "MD5",
  "currency": "cny",
  "returnUrl": "",
  "mchNo": "M1623984572"
}

回應參數

參數必填範例描述
code00-處理成功,其他-處理錯誤,具體參見錯誤碼
msgSigning failure具體錯誤原因,如:簽名失敗、參數格式校驗錯誤
signCCD9083A6DAD9A2DA9F668C3D4517A84對資料中的資料進行簽名。如果資料為空,則不會傳回。
data{}返回支付訂單,json格式資料。請參閱下面支付訂單

支付訂單:

參數名稱範例描述
payOrderIdU12021022311124442600必填.返回付款系統訂單編號
mchOrderNo20160427210604000490必填返回商家傳入的訂單編號
orderState2必填付款訂單狀態
0-已產生訂單
1-付款中
2-付款成功
3-付款失敗
4-已取消
5-已退款
6-訂單已關閉
payDataTypepayUrl必填付款參數類型
payUrl-跳轉連結方式
payDatahttps://cashier.pass2pay.io/api/scan/imgs/aa.png收銀台url
errCodeACQ.PAYMENT_AUTH_CODE_INVALID通道傳回的錯誤碼
errMsgBusiness Failed通道傳回的錯誤描述

回應樣本

{
    "code": 0,
    "data": {
        "mchOrderNo": "D202405220002",
        "orderState": 0,
        "payData": "https://cashier.passtopay.com/wayCode?payOrderToken=408e2d8d6b7b0911d12cf220e48175d9768b7cd5142a8d2e7e64b948e6c75646",
        "payDataType": "payurl",
        "payOrderId": "P1793544595691261954"
    },
    "msg": "SUCCESS",
    "sign": "65EBF84B61764231EF24F49F25AE3E84",
    "traceId": "f16bb12607ff4987b8dbe8bedc4fb99f"
}

{
    "code": 0,
    "data": {
        "mchOrderNo": "D202405220002",
        "orderState": 0,
        "payData": "alipays://platformapi/startapp?appId=20000067&url=https%3A%2F%2Fcashier-pre.xibaiyishop.com%2Falipay%3FpayOrderToken%3D34b1f1360bb8111b3d55f6a84452c5023636890021b83c0c167270dbce4fc2ff%26wc%3DALI_JSAPI%26vm%3D1",
        "payDataType": "payurl",
        "payOrderId": "P1793544595691261954"
    },
    "msg": "SUCCESS",
    "sign": "65EBF84B61764231EF24F49F25AE3E84",
    "traceId": "f16bb12607ff4987b8dbe8bedc4fb99f"
}


下面是使用不同語言發起支付訂單的代碼片段,可以作為參考:

(注意代碼中為對異常場景做處理,請結合業務場景自行處理)

        Map<String, Object> map = new HashMap<>();
        map.put("mchNo", "Merchant Number...");
        map.put("appId", "App ID...");
        map.put("mchOrderNo", "Unique Order Number...");
        map.put("amount", 10000);
        map.put("currency", "cny");
        map.put("reqTime", 1711021401000l);
        map.put("version", "1.1");
        map.put("notifyUrl", "https://www...");
        map.put("signType", "MD5");
        map.put("sign", "5182B5B0...");
        HttpResponse response = HttpRequest
                .post("http://api.pass2pay.com/api/pay/unifiedOrder")
                .form(map).execute();
        JSONObject responseJson = JSON.parseObject(response.body());
        if(responseJson.getIntValue("code") != 0){
            // failed, Please check the configuration or contact us
        }else{
            //successful, return customer payment order info
        }
Copy
<?php
$map = array(
    "mchNo" => "Merchant Number...",
    "appId" => "App ID...",
    "mchOrderNo" => "Unique Order Number...",
    "amount" => 10000,
    "currency" => "cny",
    "reqTime" => 1711021401000,
    "version" => "1.0",
    "signType" => "MD5",
    "sign" => "5182B5B0...",
    "notifyUrl" => "https://www..."
);

$extParams = array(
    "payDataType" => "codeImgUrl"
);
$map["channelExtra"] = $extParams;

$response = Requests::post('http://api.pass2pay.com/api/pay/unifiedOrder', array(), $map);
$responseJson = json_decode($response->body, true);

if ($responseJson["code"] != 0) {
    // failed, Please check the configuration or contact us
} else {
    // successful, return customer payment order info
}
?>
const axios = require('axios');

const requestData = {
  mchNo: "Merchant Number...",
  appId: "App ID...",
  mchOrderNo: "Unique Order Number...",
  wayCode: "ALI_QR",
  amount: 10000,
  currency: "cny",
  reqTime: 1711021401000,
  version: "1.0",
  signType: "MD5",
  sign: "5182B5B0...",
  subject: "Children's clothing...",
  body: "A red down jacket...",
  notifyUrl: "https://www..."
};

axios.post('http://api.pass2pay.com/api/pay/unifiedOrder', requestData)
  .then(response => {
    const responseJson = response.data;
    if (responseJson.code !== 0) {
      // failed, Please check the configuration or contact us
    } else {
      // successful, return customer payment order info
    }
  })
  .catch(error => {
    // handle error
  });
import requests

requestData = {
    "mchNo": "Merchant Number...",
    "appId": "App ID...",
    "mchOrderNo": "Unique Order Number...",
    "amount": 10000,
    "currency": "cny",
    "reqTime": 1711021401000,
    "version": "1.0",
    "signType": "MD5",
    "sign": "5182B5B0...",
    "notifyUrl": "https://www..."
}

response = requests.post('http://api.pass2pay.com/api/pay/unifiedOrder', json=requestData)
responseJson = response.json()

if responseJson["code"] != 0:
    # failed, Please check the configuration or contact us
else:
    # successful, return customer payment order info
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
)

func main() {
	requestData := map[string]interface{}{
		"mchNo":      "Merchant Number...",
		"appId":      "App ID...",
		"mchOrderNo": "Unique Order Number...",
		"amount":     10000,
		"currency":   "cny",
		"userName":   "zhang san...",
		"reqTime":    1711021401000,
		"version":    "1.0",
		"signType":   "MD5",
		"sign":       "5182B5B0...",
		"notifyUrl":  "https://www..."
	}

	requestBody, err := json.Marshal(requestData)
	if err != nil {
		fmt.Println("Error marshaling request body:", err)
		return
	}

	resp, err := http.Post("http://api.pass2pay.com/api/pay/unifiedOrder", "application/json", bytes.NewBuffer(requestBody))
	if err != nil {
		fmt.Println("Error sending request:", err)
		return
	}
	defer resp.Body.Close()

	responseBody, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		fmt.Println("Error reading response body:", err)
		return
	}

	var responseJson map[string]interface{}
	err = json.Unmarshal(responseBody, &responseJson)
	if err != nil {
		fmt.Println("Error unmarshaling response body:", err)
		return
	}

	if responseJson["code"].(float64) != 0 {
		// failed, Please check the configuration or contact us
		fmt.Println("Request failed:", responseJson["message"])
	} else {
		// successful, return customer payment order info
		fmt.Println("Request succeeded:", responseJson["data"])
	}
}