统一收单交易退款接口
开发环境
开发环境
POST
/v3/alipay/trade/refund
交易超过约定时间(签约时设置的可退款时间)的订单无法进行退款。
支付宝退款支持单笔交易分多次退款,多次退款需要提交原支付订单的订单号和设置不同的退款请求号。一笔退款失败后重新提交,要保证重试时退款请求号不能变更,防止该笔交易重复退款。
同一笔交易累计提交的退款金额不能超过原始交易总金额。
\2. 请严格按照接口文档中的参数进行接入。若在此接口中传入【非当前接口文档中的参数】会造成【退款失败或重复退款】。
\3. 该接口不可与其他退款产品混用。若商户侧同一笔退款请求已使用了当前接口退款的情况下,【再使用其他退款产品进行退款】可能会造成【重复退款】。
\4. 退款成功判断说明:接口返回fund_change=Y为退款成功,fund_change=N或无此字段值返回时需 通过退款查询接口进一步确认退款状态。详见退款成功判断指导。注意,接口中code=10000,仅代表本次退款请求成功,不代表退款成功。
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'http://dev-cn.your-api-server.com/v3/alipay/trade/refund' \
--header 'authorization: ALIPAY-SHA256withRSA app_id=$appid,timestamp=$now,nonce=$uuid,expired_seconds=600,sign=$sign' \
--header 'alipay-request-id: $requestid' \
--header 'Content-Type: application/json' \
--data-raw '{
"out_trade_no":"20150320010101001",
"trade_no":"2014112611001004680073956707",
"refund_amount":200.12,
"refund_reason":"正常退款",
"out_request_no":"HZ01RF001",
"refund_goods_detail":[
{
"goods_id":"apple-01",
"refund_amount":19.50,
"out_item_id":"outItem_01",
"out_sku_id":"outSku_01"
}
],
"refund_royalty_parameters":[
{
"royalty_type":"transfer",
"trans_out":"2088101126765726",
"trans_out_type":"userId",
"trans_in_type":"userId",
"trans_in":"2088101126708402",
"amount":0.1,
"desc":"分账给2088101126708402",
"royalty_scene":"达人佣金",
"trans_in_name":"张三"
}
],
"query_options":[
"refund_detail_item_list"
]
}'
响应示例响应示例
{
"trade_no": "2013112011001004330000121536",
"out_trade_no": "6823789339978248",
"buyer_logon_id": "159****5620",
"fund_change": "Y",
"refund_fee": 88.88,
"refund_detail_item_list": [
{
"fund_channel": "ALIPAYACCOUNT",
"amount": 10,
"real_amount": 11.21,
"fund_type": "DEBIT_CARD"
}
],
"store_name": "望湘园联洋店",
"buyer_user_id": "2088101117955611",
"send_back_fee": "1.8",
"refund_hyb_amount": "10.24",
"refund_charge_info_list": [
{
"refund_charge_fee": 0.01,
"switch_fee_rate": "0.01",
"charge_type": "trade",
"refund_sub_fee_detail_list": [
{
"refund_charge_fee": 0.1,
"switch_fee_rate": "0.01"
}
]
}
]
}
请求参数
Header 参数
authorization
string
必需
示例值:
ALIPAY-SHA256withRSA app_id=$appid,timestamp=$now,nonce=$uuid,expired_seconds=600,sign=$sign
alipay-request-id
string
必需
示例值:
$requestid
Content-Type
string
必需
示例值:
application/json
Body 参数application/json
返回响应
修改于 2023-11-23 02:56:02