创建退款
为指定交易创建退款。该接口支持对已完成的交易进行全额或部分退款。
POSThttps://api.efundpay.com/v4/transactions/{transaction_id}/refunds
This endpoint requires the
transactions.write
scope.Authorizations
Authorizationstringheaderrequired
认证请求头,格式为 `Bearer <token>`,`<token>` 为您的认证令牌。
Headers
x-merchant-account-idstringrequired
用于本次请求的商户账户ID。
Examples:
""default""
Path Parameters
transaction_idstringrequired
要创建退款的交易唯一标识。
Examples:
"7099948d-7286-47e4-aad8-b68f7eb44591"
Body
application/jsonamountintegerrequired
退款金额,单位为最小货币单位,比如1美金为100美分。
Range:x >= 1
Examples:
"1299"
"500"
currencystringrequired
退款币种。
Examples:
"USD"
"EUR"
reasonstringrequired
退款原因。
Length:1 - 255
Examples:
"Refund due to user request."
"Product return"
"Order cancellation"
external_identifierstringrequired
商户退款单号,可用于在您的系统中匹配该退款的外部标识符,需要保证全局唯一。
Length:1 - 50
Examples:
"refund-12345"
webhooks_urlstringrequired
接受退款状态通知的Webhook URL。
Examples:
"https://yourdomain.com/webhook/refund"
bank_detailobject | null
银行账户详细信息对象,QR PromptPay、泰国手机银行支付方式必填。详情请参阅退款政策。
Response
application/json
Successful Response
typestringrequired
资源类型,固定为 "refund"。
Examples:
"refund"
idstringrequired
唯一退款标识。
Examples:
"6a1d4e46-14ed-4fe1-a45f-eff4e025d211"
transaction_idstringrequired
原支付交易ID。
Examples:
"7099948d-7286-47e4-aad8-b68f7eb44591"
statusstringrequired
退款状态。可选值:processing、succeeded、failed、declined、voided。
Examples:
"succeeded"
"failed"
"processing"
currencystringrequired
本次退款的货币代码,始终与原交易一致。
Examples:
"EUR"
"USD"
"GBP"
"THB"
amountintegerrequired
退款金额,单位为最小货币单位。
Examples:
"1299"
reasonstringrequired
退款原因。
Examples:
"Refund due to user request."
"Product return"
"Order cancellation"
external_identifierstringrequired
商户退款单号,退款的外部标识符。
Examples:
"refund-12345"
transaction_external_identifierstringrequired
商户支付单号,原交易的外部标识符。
Examples:
"transaction-12345"
created_atstringrequired
创建时间(ISO 8601)。
Examples:
"2013-07-16T19:23:00.000+00:00"
curl --request POST \--url https://api.efundpay.com/v4/transactions/7099948d-7286-47e4-aad8-b68f7eb44591/refunds \--header 'Authorization: Bearer <token>' \--header 'x-merchant-account-id: <x-merchant-account-id>' \--header 'Content-Type: application/json' \--data '{"amount": 1299,"currency": "EUR","reason": "Refund due to user request.","external_identifier": "refund-12345","bank_detail": {"bank_code": "014","bank_account_name": "Jack","bank_account_no": "5015377989"}}'
{"type": "refund","id": "6a1d4e46-14ed-4fe1-a45f-eff4e025d211","transaction_id": "7099948d-7286-47e4-aad8-b68f7eb44591","status": "succeeded","currency": "EUR","amount": 1299,"reason": "Refund due to user request.","external_identifier": "refund-12345","transaction_external_identifier": "transaction-12345","created_at": "2013-07-16T19:23:00.000+00:00",}