Refund a credit transfer
Refund incoming transfers with the API.
Guide​
- Call the
refund
mutation. - Add the
originTransactionId
,consentRedirectUrl
, andamount
. - Add the
RefundSuccessPayload
payload. - Add the consent URL to the success payload (line 48):
consent
>consentUrl
. - Add the
RefundRejection
rejection in case of error.
Mutation​
🔎 Open the mutation in API Explorer
mutation RefundCreditTransfer {
refund(
input: {
consentRedirectUrl: "$YOUR_REDIRECT_URL"
refundTransactions: {
originTransactionId: "YOUR_ORIGIN_TRANSACTION_ID"
amount: { value: "22", currency: "EUR" }
}
}
) {
... on RefundSuccessPayload {
__typename
consent {
id
consentUrl
}
}
... on RefundRejection {
__typename
code
message
}
}
}
Payload​
The payload provides the consentUrl
to finalize the refund.
{
"data": {
"refund": {
"__typename": "RefundSuccessPayload",
"consent": {
"id": "YOUR_REFUND_ID",
"consentUrl": "https://identity.swan.io/consent?consentId=$YOUR_CONSENT_ID&env=Sandbox"
}
}
}
}