141 lines
11 KiB
Markdown
141 lines
11 KiB
Markdown
接口应在服务端调用,不可在前端(小程序、网页、APP等)直接调用。具体可参考[接口接入指南](https://www.yuque.com/shunchenghuichuang/iasgxw/lw3ftk64nq0f2gsg)。
|
||
|
||
接口英文名:OrderRefundQuery
|
||
|
||
该接口用于查询退款交易订单的退款结果。
|
||
|
||
## 1、调用方式
|
||
### HTTPS调用
|
||
`POST <font style="color:rgb(52,64,84);">/api/app/refundOrder/orderRefundQuery</font>`
|
||
|
||
## 2、请求参数
|
||
### <font style="color:rgb(34, 34, 34);">请求体 </font>`<font style="color:rgb(34, 34, 34);">Request Payload</font>`
|
||
| 参数名 | 类型 | 必填 | 字段长度 | 说明 |
|
||
| :--- | :--- | :--- | :--- | --- |
|
||
| service | string | 是 | - | 接口名称。<br/><font style="color:rgb(232,50,60);">此处固定值为:</font>unified_query_refund |
|
||
| sign_type | string | 否 | 10 | 接口签名类型,枚举如下:<br/>MD5:MD5签名算法<br/>SM3:国密SM3签名算法 不传默认使用MD5算法 |
|
||
| merchant_id | string | 是 | 10 | 财务交易中心商户号 |
|
||
| schc_order_id | string | 否 | 16 | 财务交易中心订单号。<br/><font style="color:rgb(232,50,60);">schc</font><font style="color:rgb(232,50,60);">_order_id</font><font style="color:rgb(232,50,60);">和</font><font style="color:rgb(232,50,60);">third_order_id</font><font style="color:rgb(232,50,60);">两者必填其一,都填优先使用</font><font style="color:rgb(232,50,60);">schc</font><font style="color:rgb(232,50,60);">_order_id</font><font style="color:rgb(232,50,60);">。</font><br/><font style="color:rgb(232,50,60);">如商户/服务商需要退3个月以上的交易,必须使用schc_order_id发起退款</font> |
|
||
| third_order_id | string | 否 | 64 | 商户订单号。<br/><font style="color:rgb(232,50,60);">schc_order_id和third_order_id两者必填其一,都填优先使用schc_order_id。</font> |
|
||
| merchant_refund_id | string | 否 | 64 | 商户退款订单号。<br/><font style="color:rgb(232,50,60);">merchant_refund_id和schc_refund_id两者必填其一,都填优先使schc_refund_id</font> |
|
||
| schc_refund_id | string | 否 | 16 | 交易中心退款订单号。<br/><font style="color:rgb(232,50,60);">merchant_refund_id和schc_refund_id两者必填其一,都填优先使schc_refund_id</font> |
|
||
| nonce_str | string | 是 | 32 | 随机字符串 |
|
||
| sign | string | 是 | 32 | 签名 |
|
||
| req_serial_no | string | 是 | 32 | 本次交易的请求流水号 |
|
||
|
||
|
||
## 3、返回参数
|
||
### <font style="color:rgb(34, 34, 34);">返回体 </font>`<font style="color:rgb(34, 34, 34);">Response Payload</font>`
|
||
XML格式返回
|
||
|
||
| 参数名 | 类型 | 说明 |
|
||
| :--- | :--- | --- |
|
||
| resp_code | string | 通信状态码。<br/>200 - 成功。<br/>非200 - 失败。<br/>注:此字段是通信标识,业务状态要看result_code |
|
||
| resp_msg | string | 通信错误说明<br/>resp_code非200时返回 |
|
||
| cost_time | string | 请求耗时。<br/>请求接口耗费的时间,单位毫秒 |
|
||
| req_serial_no | string | 本次交易的请求流水号,原样返回 |
|
||
| <font style="color:rgb(232,50,60);">以下参数在resp_code=200时返回</font> | | |
|
||
| result_code | string | 业务状态码。<br/>0 - 退款查询受理成功<br/>非0 - 退款查询受理失败<br/><font style="color:rgb(232,50,60);">注:这里只代表本次退款查询请求的业务受理结果,为0不代表退款成功,具体请结合该笔订单的状态status来确定退款结果</font> |
|
||
| error_code | string | 退款失败错误码。<br/>退款失败时返回<br/>错误码 |
|
||
| error_msg | string | 退款失败原因。<br/>退款失败时返回具体失败原因说明 |
|
||
| nonce_str | string | 随机字符串 |
|
||
| sign | string | 签名 |
|
||
| sign_type | string | 签名类型,枚举如下:<br/>MD5:MD5签名算法<br/>SM3:国密SM3签名算法 返回接口请求时设定的签名类型进行签名。 |
|
||
| merchant_id | string | 财务交易中心商户号 |
|
||
| third_order_id | string | 商户订单号。<br/>商户原支付交易订单号 |
|
||
| sub_merchant_id | string | 通道商户号。<br/>该笔订单交易时所使用的上游商户号,即微信商户号、或者支付宝商户号、或者银联商户号等 |
|
||
| mch_balance_refund | string | <font style="color:rgb(51,51,51);">商户退款类型。枚举如下:</font><br/><font style="color:rgb(51,51,51);">0</font><font style="color:rgb(51,51,51);">:未使用账户余额退款, </font><br/><font style="color:rgb(51,51,51);">1:使用账户余额退款</font> |
|
||
| <font style="color:rgb(232,50,60);">以下参数在result_code=0时返回</font> | | |
|
||
| schc_order_id | string | 交易中心交易订单号。<br/>该笔退款交易对应的原支付交易订单号。 |
|
||
| status | string | 订单支付状态,枚举如下:<br/>10:退款中<br/>11:退款成功<br/>12:退款失败 |
|
||
| refund_amount | string | 退款金额,单位:分 |
|
||
| buyer_refund_amount | string | 买家实际退款金额,单位:分 |
|
||
| merchant_refund_id | string | 商户退款订单号。 |
|
||
| schc_refund_id | string | 交易中心退款订单号。<br/>退款受理成功后,会返回该笔退款对应的交易中心退款交易订单号。 |
|
||
| amount | string | 订单总金额。单位:分。<br/><font style="color:rgb(245,34,45);">退款情况下,amount和total_amount数值一样。</font> |
|
||
| total_amount | | 订单总金额。单位:分。<br/><font style="color:rgb(245,34,45);">退款情况下,amount和total_amount数值一样。</font> |
|
||
| order_balance | string | 订单剩余可退金额。单位:分。<br/>本次退款后,订单剩余可继续发起退款的金额 |
|
||
| attach | string | 退款附加数据。<br/>原样返回退款请求时上送的attach内容。如果请求时没有上送attach参数,则不返回。<br/>注意:只能是汉字、英文字母、数字 |
|
||
| <font style="color:rgb(232,50,60);">以下参数在status=11时返回</font> | | |
|
||
| refund_time | string | 退款成功时间<br/>银联/网联返回的退款成功时间 |
|
||
| channel_order_id | string | 通道退款订单号。<br/>银联/网联返回的退款订单号。 |
|
||
| settlement_refund_amount | string | 实际退款金额。 |
|
||
| discount_refund_amount | string | 折扣优惠退款金额 |
|
||
| refund_detail | string | 退款优惠详情。<br/><font style="color:rgb(0,0,0);">优惠退款功能信息,本字段为</font><font style="color:rgb(0,0,0);">json </font><font style="color:rgb(0,0,0);">数组,详见下方</font><br/><font style="color:rgb(245,34,45);">当前仅微信交易且有退款优惠时会返回具体内容。</font> |
|
||
| refund_detail_item_list | string | 本次退款使用的资金渠道详情,<font style="color:rgb(0,0,0);">本字段为json 数组。详见下方</font> |
|
||
|
||
|
||
#### `子域参数refund_detail`
|
||
| 参数名 | 类型 | 说明 |
|
||
| --- | --- | --- |
|
||
| <font style="color:rgb(0,0,0);">promotion_id</font> | string | <font style="color:rgb(0,0,0);">券 ID 。券或者立减优惠 id</font> |
|
||
| <font style="color:rgb(0,0,0);">scope</font> | string | <font style="color:rgb(0,0,0);">优惠范围。枚举如下:</font><br/><font style="color:rgb(0,0,0);">GLOBAL</font><font style="color:rgb(0,0,0);">:全场代金券 </font><br/><font style="color:rgb(0,0,0);">SINGLE:单品优惠</font> |
|
||
| <font style="color:rgb(0,0,0);">type</font> | string | <font style="color:rgb(0,0,0);">优惠类型,枚举如下:</font><br/><font style="color:rgb(0,0,0);">COUPON</font><font style="color:rgb(0,0,0);">:代金券,需要走结算资金的充值型代金券(境外商户券币种 </font><font style="color:rgb(0,0,0);">, </font><font style="color:rgb(0,0,0);">与支付币种一 致) </font><br/><font style="color:rgb(0,0,0);">DISCOUNT:优惠券,不走结算资金 的免充 值型优惠券,(境外商户券币种与标价币种 一致</font> |
|
||
| <font style="color:rgb(0,0,0);">amount</font> | Int | <font style="color:rgb(0,0,0);">优惠券面额。</font><br/><font style="color:rgb(0,0,0);">用户享受优惠的金额</font> |
|
||
| <font style="color:rgb(0,0,0);">refund_amount</font> | Int | <font style="color:rgb(0,0,0);">优惠券退款额。</font><br/><font style="color:rgb(0,0,0);">按比例退款的优惠券金额</font> |
|
||
|
||
|
||
#### `子域参数refund_detail_item_list `
|
||
| 参数名 | 类型 | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| <font style="color:rgb(0,0,0);">fund_channel</font> | string | <font style="color:rgb(0,0,0);">交易使用的资金渠道</font> |
|
||
| <font style="color:rgb(0,0,0);">amount</font> | Int | <font style="color:rgb(0,0,0);">该支付工具类型所使用的金额</font> |
|
||
| <font style="color:rgb(0,0,0);">real_amount</font> | Int | <font style="color:rgb(0,0,0);">渠道实际付款金额</font> |
|
||
| <font style="color:rgb(0,0,0);">fund_type</font> | string | <font style="color:rgb(0,0,0);">渠道所使用的资金类型,目前只在资金渠道(fund_channel)是银行卡渠道(BANKCARD)的情况下才返回该信息</font><br/><font style="color:rgb(0,0,0);">借记卡</font><font style="color:rgb(0,0,0);">:</font><font style="color:rgb(0,0,0);">:</font><font style="color:rgb(0,0,0);">DEBIT_CARD</font><br/><font style="color:rgb(0,0,0);">信用卡:</font><font style="color:rgb(0,0,0);">CREDIT_CARD</font><br/><font style="color:rgb(0,0,0);">借贷合一卡:MIXED_CARD</font> |
|
||
|
||
|
||
## 4、注意事项
|
||
如果退款交易受理未成功,请不要调退款交易查询接口查询退款结果。
|
||
|
||
## 5、代码示例
|
||
请求参数:
|
||
|
||
```json
|
||
{
|
||
"service": "unified_query_refund",
|
||
"sign_type": "MD5",
|
||
"merchant_id": "12345678",
|
||
"schc_order_id": "0000195193826041",
|
||
"third_order_id": "17706897023453A1F3E7C48C6",
|
||
"merchant_refund_id": "17707042941793A1EC2429D75",
|
||
"schc_refund_id": "0000755593826041",
|
||
"nonce_str": "JohCmBiL",
|
||
"sign": "ZTkyNzJkYmY2MTAxNWNmZDM0YjRlZmY3YzA3YzRmODA=",
|
||
"req_serial_no": "17706897023453A1F3E7C48C6"
|
||
}
|
||
```
|
||
|
||
<font style="color:rgb(52, 64, 84);"></font>
|
||
|
||
<font style="color:rgb(52, 64, 84);">返回参数:</font>
|
||
|
||
```html
|
||
<schc>
|
||
<resp_code><![CDATA[200]]></resp_code>
|
||
<sign><![CDATA[A3D20311EE5F16B9668F39F70AFF6260]]></sign>
|
||
<result_code><![CDATA[0]]></result_code>
|
||
<refund_time><![CDATA[2022-09-30 15:14:15]]></refund_time>
|
||
<channel_order_id><![CDATA[2022092422001451681421928902]]></channel_order_id>
|
||
<nonce_str><![CDATA[rmqtvcsiwfxmirlxivzwmojexzvfbpgi]]></nonce_str>
|
||
<third_order_id><![CDATA[20220924114903108]]></third_order_id>
|
||
<schc_refund_id><![CDATA[0000601181922273]]></schc_refund_id>
|
||
<mch_balance_refund><![CDATA[1]]></mch_balance_refund>
|
||
<sub_merchant_id><![CDATA[2088410502098221]]></sub_merchant_id>
|
||
<settlement_refund_amount><![CDATA[1]]></settlement_refund_amount>
|
||
<order_balance><![CDATA[0]]></order_balance>
|
||
<discount_refund_amount><![CDATA[0]]></discount_refund_amount>
|
||
<status><![CDATA[11]]></status>
|
||
<cost_time><![CDATA[3]]></cost_time>
|
||
<sign_type><![CDATA[MD5]]></sign_type>
|
||
<amount><![CDATA[1]]></amount>
|
||
<merchant_id><![CDATA[0000000018]]></merchant_id>
|
||
<schc_order_id><![CDATA[0000700081922267]]></schc_order_id>
|
||
<refund_detail><![CDATA[]]></refund_detail>
|
||
<total_amount><![CDATA[1]]></total_amount>
|
||
<refund_amount><![CDATA[1]]></refund_amount>
|
||
<merchant_refund_id><![CDATA[T20220930151413M167JoEe]]></merchant_refund_id>
|
||
<req_serial_no><![CDATA[17706897023453A1F3E7C48C6]]></req_serial_no>
|
||
</schc>
|
||
|
||
```
|