採用HTTPS標準的POST協議,為了保證接收方接收數據正確,傳輸數據必須簽名。
{
"attach" : "It is the description of the product.",
"body" : "測試產品",
"mch_create_ip" : "127.0.0.1",
"mch_id" : "10085200000000",
"nonce_str" : "54fa7f8e1006aecb8b58ef6059abb09c",
"notify_url" : "http://www.ionline.com.hk/notify_callback",
"out_trade_no" : "TRDNO150271173415530",
"service" : "ionline.pay.weixin.native.intl",
"sign_type" : "MD5",
"total_fee" : "10",
"sign" : "6C3441C872CEEC1ACF7AB1E69D1C2C76"
}
採用標準XML協議,所有參數只存在一級節點中,不採用多級節點嵌套。
<xml>
<attach><![CDATA[It is the description of the product.]]></attach>
<body><![CDATA[測試產品]]></body>
<charset><![CDATA[UTF-8]]></charset>
<fee_type><![CDATA[HKD]]></fee_type>
<mch_id><![CDATA[10085200000000]]></mch_id>
<nonce_str><![CDATA[6223366e0ef913c796724bd1e7752a94]]></nonce_str>
<out_trade_no><![CDATA[TRDNO150271173415530]]></out_trade_no>
<out_transaction_id><![CDATA[40041381923874895783497893213]]></out_transaction_id>
<sign_type><![CDATA[MD5]]></sign_type>
<time_end><![CDATA[20170815094100]]></time_end>
<total_fee><![CDATA[10]]></total_fee>
<trade_type><![CDATA[ionline.pay.weixin.native.intl]]></trade_type>
<transaction_id><![CDATA[10085200000000150271173415530]]></transaction_id>
<version><![CDATA[1.0]]></version>
<sign><![CDATA[BFEF1345185B591EF06FBFB268DB0198]]></sign>
</xml>
協議級錯誤返回:
<xml>
<status><![CDATA[500]]></status>
<message><![CDATA[SYSERR]]></message>
</xml>
正確返回數據:
<xml>
<attach><![CDATA[It is the description of the product.]]></attach>
<body><![CDATA[測試產品]]></body>
<charset><![CDATA[UTF-8]]></charset>
<fee_type><![CDATA[HKD]]></fee_type>
<mch_id><![CDATA[10085200000000]]></mch_id>
<nonce_str><![CDATA[6223366e0ef913c796724bd1e7752a94]]></nonce_str>
<out_trade_no><![CDATA[TRDNO150271173415530]]></out_trade_no>
<out_transaction_id><![CDATA[40041381923874895783497893213]]></out_transaction_id>
<sign_type><![CDATA[MD5]]></sign_type>
<time_end><![CDATA[20170815094100]]></time_end>
<total_fee><![CDATA[10]]></total_fee>
<trade_type><![CDATA[ionline.pay.weixin.native.intl]]></trade_type>
<transaction_id><![CDATA[10085200000000150271173415530]]></transaction_id>
<version><![CDATA[1.0]]></version>
<sign><![CDATA[BFEF1345185B591EF06FBFB268DB0198]]></sign>
</xml>
業務級錯誤返回:
<xml>
<appid><![CDATA[wx238dee30432af0213]]></appid>
<err_code><![CDATA[AUTHCODE_EXPIRE]]></err_code>
<err_code_des><![CDATA[二维码已过期,请刷新再试]]></err_code_des>
<mch_id><![CDATA[10085200000000]]></mch_id>
<message><![CDATA[OK]]></message>
<nonce_str><![CDATA[19bd8070dba675db20caa8652ba40caa]]></nonce_str>
<result_code><![CDATA[1]]></result_code>
<sign_type><![CDATA[MD5]]></sign_type>
<sign><![CDATA[1C2A2E3ED5F8677824124615F8C5152B]]></sign>
</xml>
一般有返回有status參數,0表示調用成功;非0表示調用失敗。