本文将详细描述和农行对接了哪些接口,以及他们的示例报文。
- 支付请求
- 支付通知回调
- 退款请求
- 交易查询(支付和退款)
- 对账单(暂未接入)
- 关单接口(未提供)
- 农行的接口中涉及金额的单位都是元,我们平台的金额都是分,记得转换。
一.支付请求
农行提供了聚合扫码和线上JSAPI等产品。
1.微信JSAPI支付
- 入参
{
"Message":{
"Version":"V3.0.0",
"Format":"JSON",
"Merchant":{
"ECMerchantType":"EBUS",
"MerchantID":"103881909992882"
},
"TrxRequest":{
"IsBreakAccount":"0",
"NotifyType":"1",
"PaymentLinkType":"1",
"PaymentType":"8",
"ResultNotifyURL":"[http://101.68.64.83:6008/pay/api/v1/notify/abc](http://101.68.64.83:6008/pay/api/v1/notify/abc)",
"TrxType":"UnifiedOrderReq",
"Order":{
"AccountNo":"wxd9a9691ecfa23abc",
"BuyIP":"127.0.0.1",
"CommodityType":"0201",
"CurrencyCode":"156",
"InstallmentMark":"0",
"OpenID":"ouAkj1Eb-Yyi-054qhIG0MdJUQV8",
"OrderAmount":"23",
"OrderDate":"2021/06/11",
"OrderDesc":"string",
"OrderNo":"09210B611102556016507",
"OrderTime":"10:25:56",
"OrderTimeoutDate":"20210611105556",
"PayTypeID":"JSAPI",
"OrderItems":[
{
"ProductName":"string"
}
]
}
}
},
"Signature-Algorithm":"SHA1withRSA",
"Signature":"JjtgUQfBJdqFxE6IVwn7k3naKAi7GRLIab7MJl64GmsYkCFsIRA+ILWlYuQjrslTTdfDtHUyq9fqOZu4OzH85LBBVqqhQjtyhfkiiMvtAH4KxwUZQltzDZBekM34QqgxPGci+ngxik+cSbQkTaI0aMylgyM/zJdBkYNJTvQlOO0="
}
- 返回值
{
"MSG":{
"Message":{
"Version":"V3.0.0",
"Format":"JSON",
"Merchant":{
"ECMerchantType":"EBUS",
"MerchantID":"103881909992882"
},
"ReturnCode":"0000",
"ErrorMessage":"交易成功",
"TrxType":"UnifiedOrderReq",
"OrderNo":"09210B611102556016507",
"PaymentURL":"[https://pay.abchina.com/ebusperbank/PaymentModeNewAct.ebf?TOKEN=16233783568149074710](https://pay.abchina.com/ebusperbank/PaymentModeNewAct.ebf?TOKEN=16233783568149074710)",
"QRURL":"",
"PrePayID":"wx111047413636475479c546d05d27a10000",
"ThirdOrderNo":"10388190999288233783568149074710",
"OrderAmount":"23",
"OpenID":"",
"BankType":"",
"APP":{
"sub_appid":"wxd9a9691ecfa23abc",
"partnerid":"",
"prepayid":"",
"package":"prepay_id=wx111047413636475479c546d05d27a10000",
"noncestr":"",
"timestamp":"1623379661",
"sign":"JGVu+rtNb/QQb/dvTQE21c1LUy6sXn81qyZcG09ul3YYS0m+Vn92PhVoKw7OUVTTxMddL/c5e9bD2yZacdUYTrOCTUnNNMSzXJwADW1MQMxT6lbKx6xUSOhA5KC7YripTtZQugvfvEcdKNUi2Wv+qCz0duj+Gf1QOW5PAPiVLAZVCWIVVMdgHuJEvC3TCjQIFCByc3ti05kudua1zD5qeUq6iSY4Xc/yUlxXjo5LP95fh460+HaPNAp8yCRNkGKbD4Tjqr7qxdNph2C4B2rkHrtlbcPv+P/SIZYQQ40lo5fYR2U7BrtIdZrr1xKJKjrRmDHdTQokEdhmLysk0zJe/A=="
},
"JSAPI":{
"sub_appId":"wxd9a9691ecfa23abc",
"timeStamp":"1623379661",
"nonceStr":"7d356a79e39b4d27bc017e9d49db80b9",
"package":"prepay_id=wx111047413636475479c546d05d27a10000",
"signType":"RSA",
"timestamp":"1623379661",
"paySign":"Kf65EYBWw+q0CpjTiQvEI3S/Pm2nMIB9yfuB0JAf66BlxSVkqfBLUOL/TIX0Uhftb+ujYZgZyg6nPJLHfccKHQsmo8WbzRhCAaaFe09uJu1SVvKJWIAX22R6/6rEmzKIJGmW4zPCNSyryhFG3kdKsxJ3wjOexC/h7wgPyETZzXBMCWr1Tl86L7T8kDW3QHTFx7FGJNG0PJLoReCPwMMHeHDg9cnUMpvVWEJU8102r8WlT+FppIjgJDccwQhca6dUXHcV+PuqPT5/KOoKdGLYW3WaACkcWG/cpRg4mk8AQ9vVOTXmiPpzlhbtJxkqRXHuxyIo/dZT6IaPSwWh1bdqjw=="
},
"HostDate":"20210611",
"HostTime":"104740"
},
"Signature-Algorithm":"SHA1withRSA",
"Signature":"sHJi9r7hVpszbp6nafXd+/YAXlgh6Wcr20ZHRutJJH7Jo6tfkPBwxlSMSGYaKucrSS0Hq+hG4nnDA8X2fbhKrlhpUBtgxpnGntpVLBtxc0h5YfrFqADHAT7CW7eYuGyPMA34OZkLc6oL/xYFfaE9l2IRrnSy5S9tn+clOlrKUM4="
}
}
你需要取出其中的JSAPI字段的内容:
{
"sub_appId":"wxd9a9691ecfa23abc",
"timeStamp":"1623379661",
"nonceStr":"7d356a79e39b4d27bc017e9d49db80b9",
"package":"prepay_id=wx111047413636475479c546d05d27a10000",
"signType":"RSA",
"timestamp":"1623379661",
"paySign":"Kf65EYBWw+q0CpjTiQvEI3S/Pm2nMIB9yfuB0JAf66BlxSVkqfBLUOL/TIX0Uhftb+ujYZgZyg6nPJLHfccKHQsmo8WbzRhCAaaFe09uJu1SVvKJWIAX22R6/6rEmzKIJGmW4zPCNSyryhFG3kdKsxJ3wjOexC/h7wgPyETZzXBMCWr1Tl86L7T8kDW3QHTFx7FGJNG0PJLoReCPwMMHeHDg9cnUMpvVWEJU8102r8WlT+FppIjgJDccwQhca6dUXHcV+PuqPT5/KOoKdGLYW3WaACkcWG/cpRg4mk8AQ9vVOTXmiPpzlhbtJxkqRXHuxyIo/dZT6IaPSwWh1bdqjw=="
}
2. 聚合扫码付
- 入参
{
"Message":{
"Version":"V3.0.0",
"Format":"JSON",
"Merchant":{
"ECMerchantType":"EBUS",
"MerchantID":"103881909992882"
},
"TrxRequest":{
"IsBreakAccount":"0",
"NotifyType":"1",
"PaymentLinkType":"1",
"PaymentType":"A",
"ResultNotifyURL":"[http://101.68.64.83:6008/pay/api/v1/notify/abc](http://101.68.64.83:6008/pay/api/v1/notify/abc)",
"TrxType":"PayReq",
"Order":{
"AccountNo":"wxd9a9691ecfa23abc",
"BuyIP":"122.225.192.66",
"CommodityType":"0201",
"CurrencyCode":"156",
"InstallmentMark":"0",
"OpenID":"oX0xrsxe8csXcJ_zieYjk5qrAHu8",
"OrderAmount":"0.01",
"OrderDate":"2021/06/11",
"OrderDesc":"商品名称",
"OrderNo":"06210611B105230017002",
"OrderTime":"10:52:30",
"OrderTimeoutDate":"20210611112230",
"PayTypeID":"ImmediatePay",
"OrderItems":[
{
"ProductName":"商品名称"
}
]
}
}
},
"Signature-Algorithm":"SHA1withRSA",
"Signature":"dV0Lah29ejC90D1GBIxTZSQuqAMcJFKiGxJniVCgvDXM/oyoJi7BFFFDda5EA5snLF3CXPTrkUQx+eHFfAotiVN8rbxFKIUgAU++40brft+5HO7m1dpzmobyIns+Tz13e/Dtt4fIzwz8EPQ1oWKcU9nLeSbq1m7dn0X1IaXmpgw="
}
- 返回值
{
"MSG":{
"Message":{
"Version":"V3.0.0",
"Format":"JSON",
"Merchant":{
"ECMerchantType":"EBUS",
"MerchantID":"103881909992882"
},
"ReturnCode":"0000",
"ErrorMessage":"交易成功",
"TrxType":"PayReq",
"OrderNo":"06210611B105230017002",
"PaymentURL":"[https://pay.abchina.com/ebusperbank/PaymentModeNewAct.ebf?TOKEN=16233799505207397114](https://pay.abchina.com/ebusperbank/PaymentModeNewAct.ebf?TOKEN=16233799505207397114)",
"OrderAmount":"0.01",
"OneQRForAll":"[https://mobile.abchina.com/mpay/mobileBank/zh_CN/EBusinessModule/BarcodeH5Act.aspx?token=16233799505207397114](https://mobile.abchina.com/mpay/mobileBank/zh_CN/EBusinessModule/BarcodeH5Act.aspx?token=16233799505207397114)"
},
"Signature-Algorithm":"SHA1withRSA",
"Signature":"x9GWrgMQqgwLheVO4PHagtYDy9zpk2UUf0P9fp0OkzRZov5246qCUntg46+TSmTqAKXbXntbfFGsT4uglgxz5aXXtWA1KV1qNT+Jfe/7OOxW3GGd/EJeKTMv2NUIdSPyYS5Dj55T1wp6/5SAqyIUfh9iLaRdQf+Hlnr7YqAl334="
}
}
验签后,取得二维码的地址:"OneQRForAll":"https://mobile.abchina.com/mpay/mobileBank/zh_CN/EBusinessModule/BarcodeH5Act.aspx?token=16233799505207397114"
这个二维码支持微信和支付宝的扫码,所以也作聚合支付。
二.支付通知回调
如何接收支付回调
public class Notify{
public String abcRefundNotifyRes(HttpServletRequest request, HttpServletResponse response) {
String msg = request.getParameter("MSG");//这是一个密文
//而我们一般对接微信和其他银行的接收入参是如下写法
String xmlResult = IOUtils.toString(request.getInputStream(),
request.getCharacterEncoding());
}
}
- 解密前
PE1TRz48TWVzc2FnZT48VHJ4UmVzcG9uc2U+PFJldHVybkNvZGU+MDAwMDwvUmV0dXJuQ29kZT48RXJyb3JNZXNzYWdlPlN1Y2Nlc3M8L0Vycm9yTWVzc2FnZT48RUNNZXJjaGFudFR5cGU+RUJVUzwvRUNNZXJjaGFudFR5cGU+PE1lcmNoYW50SUQ+MTAzODgxOTA5OTkyODgyPC9NZXJjaGFudElEPjxUcnhUeXBlPlJlY3ZRUlBheVJlc3VsdDwvVHJ4VHlwZT48T3JkZXJObz4wNjIxMDYxMUIxMDUyMzAwMTcwMDI8L09yZGVyTm8+PEFtb3VudD4wLjAxPC9BbW91bnQ+PEJhdGNoTm8+MDAwMDA0PC9CYXRjaE5vPjxWb3VjaGVyTm8+MDAwMjkyPC9Wb3VjaGVyTm8+PEhvc3REYXRlPjIwMjEvMDYvMTE8L0hvc3REYXRlPjxIb3N0VGltZT4xMDo1Mjo0OTwvSG9zdFRpbWU+PFBheVR5cGU+RVAxMzk8L1BheVR5cGU+PE5vdGlmeVR5cGU+MTwvTm90aWZ5VHlwZT48UGF5SVA+MTI3LjAuMC4xPC9QYXlJUD48aVJzcFJlZj42QkVDRVAwMTEwNTEyMTcyODE4MTwvaVJzcFJlZj48QWNjRGF0ZT4yMDIxMDYxMTwvQWNjRGF0ZT48T3BlbklEPm90RE5vdF9MczRrV3NGU2swd2JVeldSWXBCcWM8L09wZW5JRD48YmFua190eXBlPk9USEVSUzwvYmFua190eXBlPjxUaGlyZE9yZGVyTm8+MTAzODgxOTA5OTkyODgyMzM3OTk1MDUyMDczOTcxMTQ8L1RoaXJkT3JkZXJObz48L1RyeFJlc3BvbnNlPjwvTWVzc2FnZT48U2lnbmF0dXJlLUFsZ29yaXRobT5TSEExd2l0aFJTQTwvU2lnbmF0dXJlLUFsZ29yaXRobT48U2lnbmF0dXJlPk9xcWp2TENreFZOanFoSUM1UjRQZDU2ZGk3Q01yd2hEcGNSMzV1ZmFxc0pEVzI0ZGtCckNyVEdVOEZVOXhrR1pFaEtRanlta3VmUXFaTU82a2JNcEhHa2gwSFROUytlbDlFbDI5Q3UrdS9VNFdsWm8vNG0xM0tWN2xIWTBrWEtpTElRemd3R2MwR2Q2dGpucjZINk8xVTUvL2YwTndVb2xNRkMwNXJxYkhUND08L1NpZ25hdHVyZT48L01TRz4=
- 解密后
<MSG><Message><TrxResponse><ReturnCode>0000</ReturnCode><ErrorMessage>Success</ErrorMessage><ECMerchantType>EBUS</ECMerchantType><MerchantID>103881909992882</MerchantID><TrxType>RecvQRPayResult</TrxType><OrderNo>06210611B105230017002</OrderNo><Amount>0.01</Amount><BatchNo>000004</BatchNo><VoucherNo>000292</VoucherNo><HostDate>2021/06/11</HostDate><HostTime>10:52:49</HostTime><PayType>EP139</PayType><NotifyType>1</NotifyType><PayIP>127.0.0.1</PayIP><iRspRef>6BECEP01105121728181</iRspRef><AccDate>20210611</AccDate><OpenID>otDNot_Ls4kWsFSk0wbUzWRYpBqc</OpenID><bank_type>OTHERS</bank_type><ThirdOrderNo>10388190999288233799505207397114</ThirdOrderNo></TrxResponse></Message><Signature-Algorithm>SHA1withRSA</Signature-Algorithm><Signature>OqqjvLCkxVNjqhIC5R4Pd56di7CMrwhDpcR35ufaqsJDW24dkBrCrTGU8FU9xkGZEhKQjymkufQqZMO6kbMpHGkh0HTNS+el9El29Cu+u/U4WlZo/4m13KV7lHY0kXKiLIQzgwGc0Gd6tjnr6H6O1U5//f0NwUolMFC05rqbHT4=</Signature></MSG>
三.退款请求
- 请求报文
{
"Message":{
"Version":"V3.0.0",
"Format":"JSON",
"Merchant":{
"ECMerchantType":"EBUS",
"MerchantID":"103881909992882"
},
"TrxRequest":{
"CurrencyCode":"156",
"NewOrderNo":"R0621061B1105837017011",
"OrderDate":"2021/06/11",
"OrderNo":"06210611B105230017002",
"OrderTime":"10:58:37",
"TrxAmount":"0.01",
"TrxType":"Refund"
}
},
"Signature-Algorithm":"SHA1withRSA",
"Signature":"rf2ZeGz2X84r2r74aNFP6zNtz5FWzKJkJATDSGc+UgrHBXgbmcETOOrZTB7SmcrFN47yTuDWHmQe6mVfjThcdMg72bM/WU4BkANE8odE6h1qhR/PirpYNY2un0/tHWD3yxessWHHd9wVt0LL4ccbhuPxKAmNPlDv9OuahsEvTko="
}
- 返回“已退金额超过当日可退金额”
原因1:退款必须在支付成功后15分钟后,结算账户的余额不足
原因2:退款的金额为1元,而实际支付的金额才0.01元
{
"MSG":{
"Message":{
"Version":"V3.0.0",
"Format":"JSON",
"Merchant":{
"ECMerchantType":"EBUS",
"MerchantID":"103881909992882"
},
"TrxResponse":{
"ReturnCode":"AP6410",
"ErrorMessage":"已退金额超过当日可退金额",
"TrxType":"Refund",
"OrderNo":"06210611B105230017002",
"NewOrderNo":"R0621061B1105837017011",
"TrxAmount":"0.01",
"BatchNo":"000004",
"VoucherNo":"000302",
"HostDate":"",
"HostTime":"",
"iRspRef":""
}
},
"Signature-Algorithm":"SHA1withRSA",
"Signature":"iaGbTUVwWbHfyhqOBSDtwAkVuz3oVy5CqNeiUJEC1FnKS3W9EYlfLMRzPhM36UJwoPYDpcYC/KJZJKoDIJxAcRt3OWxhI/zexEFYQ3ZdsqpH1KhX3choXGJVdbnGp61RqOiI/r7hbw+Z6EwzBkZA3HLCQ8AU6dflkCAFYhrK7qY="
}
}
- 返回“受理成功”
注意:这里只会大概率返回受理成功,没有返回过交易成功。而农行的退款处理对业务方来说,是同步的。所以业务方必须额外通过主动查询退款结果来更新退款状态。
{
"MSG":{
"Message":{
"Version":"V3.0.0",
"Format":"JSON",
"Merchant":{
"ECMerchantType":"EBUS",
"MerchantID":"103881909992882"
},
"TrxResponse":{
"ReturnCode":"0000",
"ErrorMessage":"受理成功",
"TrxType":"Refund",
"OrderNo":"06210611B105230017002",
"NewOrderNo":"R0621061B1105837017011",
"TrxAmount":"0.01",
"BatchNo":"000004",
"VoucherNo":"000322",
"HostDate":"",
"HostTime":"",
"iRspRef":""
}
},
"Signature-Algorithm":"SHA1withRSA",
"Signature":"105R2YYS0dZQmRzgrCXYSoD1JMD6gyKSJqGc8lmeZ16sGp5cAXQ7LpKb3Yw36cK/+zsV3Ewf+7ZzzaW45BfowgqcYS8dJIBiSd8ehcb8LotDVujgTCq9/fp7PB4B85aEs3+Fgx/cJIB3ESxs6EBhaXMe1KgwZb+r0+fSpOo6GwI="
}
}
四.交易查询
1.退款结果查询
1.1 微信退款
- 退款查询请求
{
"Message":{
"Version":"V3.0.0",
"Format":"JSON",
"Merchant":{
"ECMerchantType":"EBUS",
"MerchantID":"103881909992882"
},
"TrxRequest":{
"OrderNo":"R0621061B1105837017011",
"PayTypeID":"Refund",
"QueryDetail":"1",
"TrxType":"Query"
}
},
"Signature-Algorithm":"SHA1withRSA",
"Signature":"H7tG6s0xxICofy+f7G/2BR7gifXmFtXAfN2qWo8IQrSxad6goO6CpkNYa08c929NJHizbXeTqQ9zNwvI2JPZu3Sb0Y1I03RtMVXq7MroOOt7EG2FCcjQSN06xTSlDkdSzN2g5h6DMxM5pSn2ngRJA0XpiXNMSW9Yue65G9jsL/0="
}
- 退款响应报文
{
"MSG":{
"Message":{
"Version":"V3.0.0",
"Format":"JSON",
"Merchant":{
"ECMerchantType":"EBUS",
"MerchantID":"103881909992882"
},
"TrxResponse":{
"ReturnCode":"0000",
"ErrorMessage":"交易成功",
"TrxType":"Query",
"Order":"eyJQYXlUeXBlSUQiOiJXZWlYaW5SZWZ1bmQiLCJPcmRlck5vIjoiUjA2MjEwNjFCMTEwNTgzNzAxNzAxMSIsIk9yZGVyRGF0ZSI6IjIwMjEvMDYvMTEiLCJPcmRlclRpbWUiOiIxMTowMjoyNSIsIlJlZnVuZEFtb3VudCI6IjAuMDEiLCJTdGF0dXMiOiIwNCIsImlSc3BSZWYiOiI2QkVDRVAwMTExMDEzMjQyMzE4NyIsIiBNZXJSZWZ1bmRBY2NvdW50Tm8iOiIxOTAxNTYwMTA0MDAyNDA5MSIsIiBNZXJSZWZ1bmRBY2NvdW50TmFtZSI6ItXjva3Rp7qjvczT/b/GvLzT0M/euavLviIsIlNwbGl0QWNjSW5mb0l0ZW1zIjpbXX0="
}
},
"Signature-Algorithm":"SHA1withRSA",
"Signature":"BuEQ7ZvXiBc4fyNoesT2tAgsLCgB7DOmnG8IFdikcHNVmknGXkapQMNe7NmC0nXojjqHSP+kRil+nLTZLpQ2a6ZPdNJ5euEF8pQzbKk6ulGO1ZP1rLzCzWNldUCCm54h9SoK95lLXi+RhA9Eg+Gb/f1HihGYR6xeO0/dF7HCF/c="
}
}
因为查询的是明细,Order内容是加密的,所以我们需要解密。
String orderDecodeStr = Base64Code.Decode64(json.GetKeyValue("Order"));
- 明文内容:
{"PayTypeID":"WeiXinRefund","OrderNo":"R0621061B1105837017011","OrderDate":"2021/06/11","OrderTime":"11:02:25","RefundAmount":"0.01","Status":"04","iRspRef":"6BECEP01110132423187"," MerRefundAccountNo":"19015601040024091"," MerRefundAccountName":"浙江学海教育科技有限公司","SplitAccInfoItems":[]}
1.2 支付宝退款
为什么写了微信退款,这里还要写支付宝退款的示例,难道他们还不一样吗?是的,就是不一样!!但是查询交易结果的接口又是同一个接口,所以少不了有判断语句。
String payTypeID = orderObject.getString("PayTypeID");
//PayTypeID 根据交易类型判断是退款还是支付
// AliRefund-支付宝退款
// WeiXinRefund-微信退款
if (payTypeID.contains(AbcBankConfig.PayType.PAY_TYPE_REFUND)) {
//退款交易
} else {
//支付交易
}
- 请求报文
{
"Message":{
"Version":"V3.0.0",
"Format":"JSON",
"Merchant":{
"ECMerchantType":"EBUS",
"MerchantID":"103881909992882"
},
"TrxRequest":{
"OrderNo":"R062B10611143634017069",
"PayTypeID":"Refund",
"QueryDetail":"1",
"TrxType":"Query"
}
},
"Signature-Algorithm":"SHA1withRSA",
"Signature":"Y7S6xSCUR21NzB0VEAdeOH76vBHjDKtHZpqkeVpZCzAV3VdIx27HU06oFUbEDzlQ6fOxCFsaooUR/vhTgGOymykAIyUbjPtdlBchMz2iKukqu2W1Py+cSTrdpk9iKq+hJxi3BnCi12Qs8hpMCAFJj+WIGJ2rFvP2H/gDfmP3j0s="
}
- 响应报文
{
"MSG":{
"Message":{
"Version":"V3.0.0",
"Format":"JSON",
"Merchant":{
"ECMerchantType":"EBUS",
"MerchantID":"103881909992882"
},
"TrxResponse":{
"ReturnCode":"0000",
"ErrorMessage":"交易成功",
"TrxType":"Query",
"Order":"eyJQYXlUeXBlSUQiOiJBbGlSZWZ1bmQiLCJPcmRlck5vIjoiUjA2MkIxMDYxMTE0MzYzNDAxNzA2OSIsIk9yZGVyRGF0ZSI6IjIwMjEvMDYvMTEiLCJPcmRlclRpbWUiOiIxNDozNjozNCIsIlJlZnVuZEFtb3VudCI6IjAuMDEiLCJTdGF0dXMiOiIwNCIsImlSc3BSZWYiOiI2QkVDRVAwMTE0Mjc0MDQyNzk3MSIsIiBNZXJSZWZ1bmRBY2NvdW50Tm8iOiIxOTAxNTYwMTA0MDAyNDA5MSIsIiBNZXJSZWZ1bmRBY2NvdW50TmFtZSI6ItXjva3Rp7qjvczT/b/GvLzT0M/euavLviIsIlNwbGl0QWNjSW5mb0l0ZW1zIjpbXX0="
}
},
"Signature-Algorithm":"SHA1withRSA",
"Signature":"wiJNANAJhUbjx+Zzcc8AUMo3/thh+QrTocvV6XZByvWIVq5es4peQHt7XqvGjSDUD0JcOFThixeOAVDmyGoWXO5+6B6oXfTiwNJbRICoqgpUbx2YbsEc0FsRpKb2mn4R8CzqFAjRqp7j7hdc+LNPcq+pYMr7ZFZgZjKYkcNIUEQ="
}
}
- 明文内容
{
"PayTypeID":"AliRefund",
"OrderNo":"R062B10611143634017069",
"OrderDate":"2021/06/11",
"OrderTime":"14:36:34",
"RefundAmount":"0.01",
"Status":"04",
"iRspRef":"6BECEP01142740427971",
" MerRefundAccountNo":"19015601040024091",
" MerRefundAccountName":"浙江学海教育科技有限公司",
"SplitAccInfoItems":[
]
}
status=04-退款成功,官方的文档对交易状态的描述容易让人产生歧义。 应该这么理解:查询交易状态,只要是成功,便表示交易按要求顺利完成,该支付的支付成功了,该退款的给用户退还款项了。
而不要去看05-已退款,这个状态据技术对接人员回复,已退款是对支付订单而言的,虽然是收了用户的钱,但后来给退还回去了。
这里存在一个使用上面的原则问题,查询支付结果的入参必须是支付流水号,查询退款结果的入参必须是退款流水号。所以当提供一个已退款但是实际上曾经付清的订单号,查询结果应该是04还是05呢。
2.支付结果查询
- 请求报文
{
"Message":{
"Version":"V3.0.0",
"Format":"JSON",
"Merchant":{
"ECMerchantType":"EBUS",
"MerchantID":"103881909992882"
},
"TrxRequest":{
"OrderNo":"0621061B1141826017047",
"PayTypeID":"ImmediatePay",
"QueryDetail":"1",
"TrxType":"Query"
}
},
"Signature-Algorithm":"SHA1withRSA",
"Signature":"OXpQla2AmbuJ2V0D0QRdz6rGrXRZANxQNQC68uB9s2T5TGO/Mgd9CxQ9qs2M8+OV/jFI1ISgTeIgsezugvpkAt+A663g0F4VBqXOBEdXthKkj4LG2qUpIzFGUT40BY/0C4wSlkXKAEXEYvzl+aOFRUF5LTXj/L6uhJoZLuSVjCI="
}
- 响应报文
{
"MSG":{
"Message":{
"Version":"V3.0.0",
"Format":"JSON",
"Merchant":{
"ECMerchantType":"EBUS",
"MerchantID":"103881909992882"
},
"TrxResponse":{
"ReturnCode":"0000",
"ErrorMessage":"交易成功",
"TrxType":"Query",
"Order":"eyJQYXlUeXBlSUQiOiJ3ZWl4aW5wYXkiLCJPcmRlck5vIjoiMDYyMTA2MUIxMTQxODI2MDE3MDQ3IiwiT3JkZXJEYXRlIjoiMjAyMS8wNi8xMSIsIk9yZGVyVGltZSI6IjE0OjE4OjI2IiwiT3JkZXJBbW91bnQiOiIwLjAxIiwiU3RhdHVzIjoiMDEiLCJPcmRlckRlc2MiOiLJzMa3w/uzxiIsIk9yZGVyVVJMIjoiIiwiUGF5bWVudExpbmtUeXBlIjoiMSIsIkFjY3RObyI6Ik5PREVGIiwiQ29tbW9kaXR5VHlwZSI6IjAyMDIiLCJSZWNlaXZlckFkZHJlc3MiOiIiLCJCdXlJUCI6IjM2LjE3LjEyMi4xOTAiLCJpUnNwUmVmIjoiNkJFQ0VQMDExNDE0MjU3NzM0NjEiLCJSZWNlaXZlQWNjb3VudCI6IjE5MDE1NjAxOTQ5MDAxNTYyIiwiUmVjZWl2ZUFjY05hbWUiOiLV472t0ae6o73M0/2/xry809DP3rmry74iLCJNZXJjaGFudFJlbWFya3MiOiIiLCJVc2VySUQiOiIiLCJUaGlyZE9yZGVyTm8iOiIxMDM4ODE5MDk5OTI4ODIzMzkyMzA2NTM4MDEwMTk5MCIsIlRoaXJkUmVPcmRlck5vIjoiTk9ERUYiLCJzekFjY0RhdGUiOiJOT0RFRiIsIkpSTk5PIjoiIiwiQmFua1R5cGUiOiIiLCJCVVlFUl9VU0VSX0lEIjoiIiwiV1hSZXROb3RpZnlaaXBwZWRQYXlsb2FkIjoiIiwiU3BsaXRBY2NJbmZvSXRlbXMiOltdLCJPcmRlckl0ZW1zIjpbeyJTdWJNZXJOYW1lIjoiIiwiU3ViTWVySWQiOiIiLCJTdWJNZXJNQ0MiOiIiLCJTdWJNZXJjaGFudFJlbWFya3MiOiIiLCJQcm9kdWN0SUQiOiIiLCJQcm9kdWN0TmFtZSI6IsnMxrfD+7PGIiwiVW5pdFByaWNlIjoiIiwiUXR5IjoiIiwiUHJvZHVjdFJlbWFya3MiOiIifV19"
}
},
"Signature-Algorithm":"SHA1withRSA",
"Signature":"i+sifRdF1JltiIAevRK4X2OuJHRhQ9ch84NOEo98YMwabDTgpvYxWStnDvzC11slZD1LpEKoDekfyt1flFqzffsCLhjMDJLDoshmH+MnL5Yj4N80ALpCoWNTAEsqwF6zVZT8z4t4nhx/8M2m9x0VIOAnwLt7MZpHshM7U6C56zw="
}
}
- 解密后的报文是:
{
"PayTypeID":"weixinpay",
"OrderNo":"0621061B1141826017047",
"OrderDate":"2021/06/11",
"OrderTime":"14:18:26",
"OrderAmount":"0.01",
"Status":"01",
"OrderDesc":"商品名称",
"OrderURL":"",
"PaymentLinkType":"1",
"AcctNo":"NODEF",
"CommodityType":"0202",
"ReceiverAddress":"",
"BuyIP":"36.17.122.190",
"iRspRef":"6BECEP01141425773461",
"ReceiveAccount":"19015601949001562",
"ReceiveAccName":"浙江学海教育科技有限公司",
"MerchantRemarks":"",
"UserID":"",
"ThirdOrderNo":"10388190999288233923065380101990",
"ThirdReOrderNo":"NODEF",
"szAccDate":"NODEF",
"JRNNO":"",
"BankType":"",
"BUYER_USER_ID":"",
"WXRetNotifyZippedPayload":"",
"SplitAccInfoItems":[
],
"OrderItems":[
{
"SubMerName":"",
"SubMerId":"",
"SubMerMCC":"",
"SubMerchantRemarks":"",
"ProductID":"",
"ProductName":"商品名称",
"UnitPrice":"",
"Qty":"",
"ProductRemarks":""
}
]
}
这里的status=01-未支付, status=04-已支付
网友评论