问题可复现
使用环境:微信h5中调用
支付分已完结的订单,申请退款时,使用外部商户订单号进行退款,会出现RESOURCE_NOT_EXISTS,订单不存在错误提示。
支付成功返回:
{
"code": "200",
"msg": "请求成功",
"data": "{\"appid\":\"xxx\",\"mchid\":\"xxx\",\"service_id\":\"xxx\",\"out_order_no\":\"M20210712001\",\"service_introduction\":\"xxx租借服务\",\"state\":\"DONE\",\"state_description\":\"\",\"total_amount\":100,\"post_payments\":[{\"name\":\"租借费\",\"amount\":100,\"description\":\"0.01/分钟\"}],\"risk_fund\":{\"name\":\"DEPOSIT\",\"amount\":9900,\"description\":\"\"},\"time_range\":{\"start_time\":\"20210712162957\",\"end_time\":\"20210712163211\"},\"attach\":\"\",\"notify_url\":\"http://xxx/xxx/payScoreCallbackNotification.do\",\"order_id\":\"1000000000202107121390175710571\",\"need_collection\":true,\"collection\":{\"state\":\"USER_PAID\",\"total_amount\":100,\"paying_amount\":0,\"paid_amount\":100,\"details\":[{\"amount\":100,\"paid_type\":\"NEWTON\",\"paid_time\":\"20210712163213\",\"transaction_id\":\"4200001188202107123853641530\"}]},\"openid\":\"oSaGm6EJRRkZ30_US62dfR9Ps0rQ\"}"
}
//1.申请退款请求代码(out_trade_no):
{
"amount": {
"currency": "CNY",
"refund": 1,
"total": 100
},
"notify_url": "http://xxx/xxx/refundCallbackNotification.do",
"out_refund_no": "tk4wyp81811vqW003t17kA3F8g85u64ID7",
"out_trade_no": "M20210712001",
"reason": "手动退款"
}
//退款返回
{"code":"RESOURCE_NOT_EXISTS","message":"订单不存在"}
2.使用transaction_id进行退款是可以的
退款请求参数(使用微信支付单号transaction_id):
{
"amount": {
"currency": "CNY",
"refund": 1,
"total": 100
},
"notify_url": "http://xxx/xxx/refundCallbackNotification.do",
"out_refund_no": "tk5rS72co70JA8080vt66638aR628979qI",
"reason": "手动退款",
"transaction_id": "4200001188202107123853641530"
}
退款返回:
{
"code": "200",
"msg": "请求成功",
"data": "{\"mchid\":\"xxx\",\"out_trade_no\":\"NN1yXx4f68mvIoqIMs2wY7xxxxj0gPZx\",\"transaction_id\":\"4200001188202107123853641530\",\"out_refund_no\":\"tk5rS72co70JA8080vt66638aR628979qI\",\"refund_id\":\"50301608892021071210582812260\",\"refund_status\":\"SUCCESS\",\"success_time\":\"2021-07-12T16:36:59+08:00\",\"amount\":{\"total\":100,\"refund\":1,\"payer_total\":100,\"payer_refund\":1},\"user_received_account\":\"支付用户零钱通\"}"
}
在支付分中out_order_no 是服务单号,申请退款你用transaction_id吧
可能正如楼上大佬所说,`out_trade_no` 好像和 `out_order_no` 不是一个东西。
测试的时候,使用 transaction_id 退款时,同步返回了一个 `out_order_no` 这个字段(上面代码已贴出),使用这个字段退款也是可以的。
`out_trade_no` 好像和 `out_order_no` 不是一个东西,支付分订单没有 `out_trade_no`。