Create a refund | Moov Documentation
Create a refund
Initiate a refund for a card transfer.
Use the Cancel or refund a card transfer endpoint for more comprehensive cancel and refund options.
See the reversals guide for more information.
To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/transfers.write scope.
POST
/accounts/{accountID}/transfers/{transferID}/refunds
Ask
curl -X POST "https://api.moov.io/accounts/{accountID}/transfers/{transferID}/refunds" \
-H "Authorization: Bearer {token}" \
-H "X-Moov-Version: v2026.04.00"
Ask
mc, _ := moov.NewClient()
var accountID string
var transferID string
mc.RefundTransfer(ctx, accountID, transferID, moov.CreateRefund{
Amount: 1700,
})
Ask
import { Moov } from "@moovio/sdk";
const moov = new Moov({
security: {
username: "",
password: "",
},
});
async function run() {
const result = await moov.transfers.initiateRefund({
xIdempotencyKey: "8d9af6b8-67e1-4efa-8188-68039f34097d",
accountID: "cb6ae9f9-afab-4f06-9eb0-8abf54a3ada2",
transferID: "04022119-95be-4ef4-9dd4-b3782f6aa7b9",
createRefund: {
amount: 1000,
},
});
console.log(result);
}
run();
Ask
declare(strict_types=1);
require 'vendor/autoload.php';
use Moov\MoovPhp;
use Moov\MoovPhp\Models\Components;
use Moov\MoovPhp\Models\Operations;
$sdk = MoovPhp\Moov::builder()
->setSecurity(
new Components\Security(
username: '',
password: '',
)
)
->build();
$request = new Operations\InitiateRefundRequest(
xIdempotencyKey: '8d9af6b8-67e1-4efa-8188-68039f34097d',
accountID: 'cb6ae9f9-afab-4f06-9eb0-8abf54a3ada2',
transferID: '04022119-95be-4ef4-9dd4-b3782f6aa7b9',
createRefund: new Components\CreateRefund(
amount: 1000,
),
);
$response = $sdk->transfers->initiateRefund(
request: $request
);
if ($response->createRefundResponse !== null) {
// handle response
}
Ask
package hello.world;
import io.moov.sdk.Moov;
import io.moov.sdk.models.components.*;
import io.moov.sdk.models.errors.*;
import io.moov.sdk.models.operations.InitiateRefundRequest;
import io.moov.sdk.models.operations.InitiateRefundResponse;
import java.lang.Exception;
import java.lang.Object;
public class Application {
public static void main(String[] args) throws GenericError, CardAcquiringRefund, RefundValidationError, Exception {
Moov sdk = Moov.builder()
.security(Security.builder()
.username("")
.password("")
.build())
.build();
InitiateRefundRequest req = InitiateRefundRequest.builder()
.xIdempotencyKey("8d9af6b8-67e1-4efa-8188-68039f34097d")
.accountID("cb6ae9f9-afab-4f06-9eb0-8abf54a3ada2")
.transferID("04022119-95be-4ef4-9dd4-b3782f6aa7b9")
.createRefund(CreateRefund.builder()
.amount(1000L)
.build())
.build();
InitiateRefundResponse res = sdk.transfers().initiateRefund()
.request(req)
.call();
if (res.createRefundResponse().isPresent()) {
CreateRefundResponse unionValue = res.createRefundResponse().get();
Object raw = unionValue.value();
if (raw instanceof io.moov.sdk.models.components.CardAcquiringRefund) {
io.moov.sdk.models.components.CardAcquiringRefund cardAcquiringRefundValue = (io.moov.sdk.models.components.CardAcquiringRefund) raw;
// Handle cardAcquiringRefund variant
} else if (raw instanceof AsyncCreatedRefund) {
AsyncCreatedRefund yncCreatedRefundValue = (AsyncCreatedRefund) raw;
// Handle asyncCreatedRefund variant
} else {
// Unknown or unsupported variant
}
}
}
}
Ask
from moovio_sdk import Moov
from moovio_sdk.models import components
with Moov(
security=components.Security(
username="",
password="",
),
) as moov:
res = moov.transfers.initiate_refund(x_idempotency_key="8d9af6b8-67e1-4efa-8188-68039f34097d", account_id="cb6ae9f9-afab-4f06-9eb0-8abf54a3ada2", transfer_id="04022119-95be-4ef4-9dd4-b3782f6aa7b9", amount=1000)
# Handle response
print(res)
Ask
require 'moov_ruby'
Models = ::Moov::Models
s = ::Moov::Client.new(
security: Models::Components::Security.new(
username: '',
password: ''
)
)
req = Models::Operations::InitiateRefundRequest.new(
x_idempotency_key: '8d9af6b8-67e1-4efa-8188-68039f34097d',
account_id: 'cb6ae9f9-afab-4f06-9eb0-8abf54a3ada2',
transfer_id: '04022119-95be-4ef4-9dd4-b3782f6aa7b9',
create_refund: Models::Components::CreateRefund.new(
amount: 1000
)
)
res = s.transfers.initiate_refund(request: req)
unless res.create_refund_response.nil?
# handle response
end
Ask
using Moov.Sdk;
using Moov.Sdk.Models.Components;
using Moov.Sdk.Models.Requests;
var sdk = new MoovClient(security: new Security() {
Username = "",
Password = "",
});
InitiateRefundRequest req = new InitiateRefundRequest() {
XIdempotencyKey = "8d9af6b8-67e1-4efa-8188-68039f34097d",
AccountID = "cb6ae9f9-afab-4f06-9eb0-8abf54a3ada2",
TransferID = "04022119-95be-4ef4-9dd4-b3782f6aa7b9",
Body = new CreateRefund() {
Amount = 1000,
},
};
var res = await sdk.Transfers.InitiateRefundAsync(req);
// handle response
The request completed successfully.
Ask
Ask Successful async refund
{
"amount": {
"currency": "USD",
"value": 1204
},
"createdOn": "2023-09-09T14:15:22Z",
"refundID": "d4963079-5b35-4d17-981e-8f851753f786"
}
Successful sync refund
{
"amount": {
"currency": "USD",
"value": 1204
},
"cardDetails": {
"confirmedOn": "2023-09-09T14:17:41Z",
"initiatedOn": "2023-09-09T14:16:22Z",
"status": "confirmed"
},
"createdOn": "2023-09-09T14:15:22Z",
"refundID": "d4963079-5b35-4d17-981e-8f851753f786",
"status": "pending",
"updatedOn": "2023-09-09T14:17:41Z"
}
Response headers
A unique identifier used to trace requests.
A refund was successfully created but an error occurred while waiting for a synchronous response.
Ask
Example
Details of a card refund.
{
"refundID": "string",
"createdOn": "2019-08-24T14:15:22Z",
"updatedOn": "2019-08-24T14:15:22Z",
"status": "created",
"amount": {
"currency": "USD",
"value": 1204
},
"cardDetails": {
"status": "initiated",
"failureCode": "call-issuer",
"initiatedOn": "2019-08-24T14:15:22Z",
"confirmedOn": "2019-08-24T14:15:22Z",
"settledOn": "2019-08-24T14:15:22Z",
"failedOn": "2019-08-24T14:15:22Z",
"completedOn": "2019-08-24T14:15:22Z"
}
}
Response headers
A unique identifier used to trace requests.
The server could not understand the request due to invalid syntax.
Ask
Example
{
"error": "string"
}
Response headers
A unique identifier used to trace requests.
The requested resource was not found.
Response headers
A unique identifier used to trace requests.
Attempted to create a refund using a duplicate X-Idempotency-Key header.
Ask
Example
Details of a card refund.
Response headers
A unique identifier used to trace requests.
The request was well-formed, but the contents failed validation. Check the request for missing or invalid fields.
Ask
Example
{
"amount": "string",
"error": "string"
}
Response headers
A unique identifier used to trace requests.
Request was refused due to rate limiting.
Response headers
A unique identifier used to trace requests.
The request failed due to an unexpected error.
Response headers
A unique identifier used to trace requests.
The request failed because a downstream service failed to respond.
Response headers
A unique identifier used to trace requests.
Set this header to v2026.04.00 to use the API described in this specification. When omitted, the server defaults to v2024.01.00, which may not match the behavior documented here.
Possible values:
v2026.04.00
Prevents duplicate refunds from being created.
Optional header that indicates whether to return a synchronous response that includes full transfer and rail-specific details or an asynchronous response indicating the transfer was created (this is the default response if the header is omitted). A timeout will occur after 15 seconds.
Possible values:
rail-response
The merchant's Moov account ID.
Identifier for the transfer.
Specifies a partial amount to refund.
This request body is optional, an empty body will issue a refund for the full amount of the original transfer.
Amount to refund in cents. If null, the original transfer's full amount will be refunded.
Details of a card refund.
Show child attributes
A 3-letter ISO 4217 currency code.
Quantity in the smallest unit of the specified currency.
In USD this is cents, for example, $12.04 is 1204 and $0.99 is 99.
Show child attributes
Possible values:
initiated,
confirmed,
settled,
failed,
completed
Possible values:
call-issuer,
do-not-honor,
processing-error,
invalid-transaction,
invalid-amount,
no-such-issuer,
reenter-transaction,
cvv-mismatch,
lost-or-stolen,
insufficient-funds,
invalid-card-number,
invalid-merchant,
expired-card,
incorrect-pin,
transaction-not-allowed,
suspected-fraud,
amount-limit-exceeded,
velocity-limit-exceeded,
revocation-of-authorization,
card-not-activated,
issuer-not-available,
could-not-route,
cardholder-account-closed,
unknown-issue,
duplicate-transaction
Identifier for the refund.
Possible values:
created,
pending,
completed,
failed
Asynchronous refund response
Show child attributes
A 3-letter ISO 4217 currency code.
Quantity in the smallest unit of the specified currency.
In USD this is cents, for example, $12.04 is 1204 and $0.99 is 99.