result <xml><return_code><![CDATA[SUCCESS]]></return_code><result_code><![CDATA[SUCCESS]]></result_code><mch_id><![CDATA[16006989XX]]></mch_id><sub_mch_id><![CDATA[16303602XX]]></sub_mch_id><nonce_str><![CDATA[a808655a8fb0c7c6]]></nonce_str><sign><![CDATA[FA25CCE32E91B4D9213FF15417A7FE5EF65230B12CE67CDB7E1161A64D2DD0FF]]></sign><transaction_id><![CDATA[4200067681202305286412740859]]></transaction_id><out_order_no><![CDATA[OD20230528220110PFNIKM]]></out_order_no><order_id><![CDATA[30001904262023052849351990420]]></order_id><status><![CDATA[FINISHED]]></status><receivers><![CDATA[[{"type":"MERCHANT_ID","account":"16006983XX","amount":10,"description":"平台手续费","result":"CLOSED","finish_time":"20230528220159","fail_reason":"PAYER_ACCOUNT_ABNORMAL","detail_id":"36001904262023052869671591815"},{"type":"MERCHANT_ID","account":"16303602XX","amount":987,"description":"解冻给分账方","result":"SUCCESS","finish_time":"20230528220200","detail_id":"36001904262023052869671591817"}]]]>
</receivers>
分账退款逻辑
注:分账订单的退款与分账回退并无强耦合,分账回退的资金是回到商户可用余额中,分账回退可先于退款发起,可后于退款发起,或者根据分账方与商户的约定,不发起分账回退
报错:分账回退出资商户不允许和接收商户相同,请重新输入回退商户号
问题1, 有一笔订单总共10元,调用分帐后,平台手续费分帐: 10分钱, 特约商户分帐:987分钱,余下的的3分钱是微信的手续费么?
问题2, 当用户发起退款时,我先查询分帐结果 https://api.mch.weixin.qq.com/pay/profitsharingquery 这个接口,返回数据如下:
result <xml> <return_code><![CDATA[SUCCESS]]></return_code> <result_code><![CDATA[SUCCESS]]></result_code> <mch_id><![CDATA[16006989XX]]></mch_id> <sub_mch_id><![CDATA[16303602XX]]></sub_mch_id> <nonce_str><![CDATA[a808655a8fb0c7c6]]></nonce_str> <sign><![CDATA[FA25CCE32E91B4D9213FF15417A7FE5EF65230B12CE67CDB7E1161A64D2DD0FF]]></sign> <transaction_id><![CDATA[4200067681202305286412740859]]></transaction_id> <out_order_no><![CDATA[OD20230528220110PFNIKM]]></out_order_no> <order_id><![CDATA[30001904262023052849351990420]]></order_id> <status><![CDATA[FINISHED]]></status> <receivers><![CDATA[[{"type":"MERCHANT_ID","account":"16006983XX","amount":10,"description":"平台手续费","result":"CLOSED","finish_time":"20230528220159","fail_reason":"PAYER_ACCOUNT_ABNORMAL","detail_id":"36001904262023052869671591815"},{"type":"MERCHANT_ID","account":"16303602XX","amount":987,"description":"解冻给分账方","result":"SUCCESS","finish_time":"20230528220200","detail_id":"36001904262023052869671591817"}]]]> </receivers>
从分帐结果来看 , 10分钱的平台手续是关闭状态的,987分是解冻给特约商户的,是成功的。
再执行分帐回退后,请求数据:
<?xml version="1.0" encoding="UTF-8"?> <xml> <nonce_str>29cc7e59e76340d5bad28f2f7992cb7c</nonce_str> <return_amount>987</return_amount> <return_account>16303602XX</return_account> <sign>C8A56CC3393A0424C52908541D244B4D5274A119882E70A006A088A967D4E142</sign> <out_order_no>OD20230528220110PFNIKM</out_order_no> <description>用户退货</description> <mch_id>16006983XX</mch_id> <sub_mch_id>16303602XX</sub_mch_id> <appid>wx45e53a66a9eb28XX</appid> <out_return_no>RF2023060210360731786573</out_return_no> <return_account_type>MERCHANT_ID</return_account_type> <sign_type>HMAC-SHA256</sign_type> <order_id>30001904262023052849351990420</order_id> </xml>
结果如下:
<xml> <return_code><![CDATA[FAIL]]></return_code> <error_code><![CDATA[INVALID_REQUEST]]></error_code> <error_msg><![CDATA[分账回退出资商户不允许和接收商户相同,请重新输入回退商户号]]></error_msg> </xml>
那岂不是要让物约商户再申请一个商户号,那有两个商户号才行? 请问我的逻辑哪里出问题了?