Wechat payment refund API address: https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_4&index=6
Precautions:
- Total fee: must be the payment amount of the order, unit: minute;
- Refund fee: less than the order payment amount, unit: minute;
- Multiple refunds can be initiated for the same order, and the out \;
- Use a merchant refund No. for refund. If the refund fails for some reason, it will not affect the use of other merchant refund No. for refund next time.
Some error messages
- The total amount in the refund is inconsistent with the total amount of wechat payment order
Refund request <xml> <sign>464fd80d3822f288396c321501a06c29</sign> <refund_fee>21500</refund_fee> <mch_id>123</mch_id> <op_user_id>1232846202</op_user_id> <total_fee>21500</total_fee> --This must be the total price at the time of payment, especially when refunding in batches <appid>123123123123</appid> <out_refund_no>20160601195633930</out_refund_no> <out_trade_no>2016053017063826030</out_trade_no> <nonce_str>nNlsPAcmpP</nonce_str> </xml> Refund response <xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[OK]]></return_msg> <appid><![CDATA[123123123123]]></appid> <mch_id><![CDATA[123]]></mch_id> <nonce_str><![CDATA[F8bnSKUY7qvEpQtk]]></nonce_str> <sign><![CDATA[908963603B666ECB7FC0F0AE1C1F22EA]]></sign> <result_code><![CDATA[FAIL]]></result_code> <err_code><![CDATA[REFUND_FEE_MISMATCH]]></err_code> <err_code_des><![CDATA[The same out_refund_no Refund amount should be consistent]]></err_code_des> </xml>
- Refund fee is greater than total fee
<xml><return_code><![CDATA[FAIL]]></return_code> <return_msg><![CDATA[invalid refund_fee]]></return_msg> </xml>
- The payment amount of the order has been fully refunded
<xml><return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[OK]]></return_msg> <appid><![CDATA[123123123123]]></appid> <mch_id><![CDATA[123]]></mch_id> <nonce_str><![CDATA[UdhYGRO1wLNkR0TR]]></nonce_str> <sign><![CDATA[3FD2B2A28ECF24565CA35FCB76149431]]></sign> <result_code><![CDATA[FAIL]]></result_code> <err_code><![CDATA[TRADE_STATE_ERROR]]></err_code> <err_code_des><![CDATA[Order status error]]></err_code_des> </xml>
- Lack of certificate
wx sendpost exception org.apache.http.NoHttpResponseException: api.mch.weixin.qq.com:443 failed to respond
Reference resources: http://blog.csdn.net/u011160656/article/details/41946873
https://blog.csdn.net/luojinbai/article/details/50921507