Welcome to Xendit’s latest documentation. For legacy content, access the previous documentation here or the previous API reference here.

Refund a payment request

Prev Next
Post
/refunds

Initiate a refund for a given successful payment request.

Security
HTTP
Type basic
Header parameters
for-user-id
string

The XenPlatform subaccount user id that will perform this transaction.

Body parameters
Refund_With_Amount
{
  "reference_id": "90392f42-d98a-49ef-a7f3-abcezas123",
  "payment_request_id": "pr-90392f42-d98a-49ef-a7f3-abcezas123",
  "currency": "IDR",
  "amount": 10000,
  "reason": "REQUESTED_BY_CUSTOMER"
}
Refund_Without_Amount
{
  "reference_id": "90392f42-d98a-49ef-a7f3-abcezas123",
  "payment_request_id": "pr-90392f42-d98a-49ef-a7f3-abcezas123",
  "reason": "REQUESTED_BY_CUSTOMER"
}
Expand All
object

Create refund API request body

payment_request_id
string Required

Xendit unique Payment Request ID generated as reference after creation of payment request.

Examplepr-1102feb0-bb79-47ae-9d1e-e69394d3949c
reference_id
string

A Reference ID from merchants to identify their request.

Min length1
Max length255
currency
string

ISO 4217 three-letter currency code for the payment.

Valid values[ "IDR", "PHP", "VND", "THB", "SGD", "MYR", "USD" ]
ExampleIDR
amount
number

The intended payment amount to be refunded to the end user.

Minimum0.0
Example10000
reason
string Required

Status of the refund.

Valid values[ "FRAUDULENT", "DUPLICATE", "REQUESTED_BY_CUSTOMER", "CANCELLATION", "OTHERS" ]
metadata
object (Payments_API_MerchantMetadata)

Key-value entries for your custom data. You can specify up to 50 keys, with key names up to 40 characters and values up to 500 characters. This is for your convenience. Xendit will not use this data for any processing.

Example{ "my_custom_id": "merchant-123", "my_custom_order_id": "order-123" }
Responses
200

Refund is pending. Check the final status of the refund via webhook.

Expand All
object

Refund object

id
string

Xendit unique Refund ID generated as reference after creation of refund.

Examplerfd-69e77490-d2cc-4bf3-8319-e064e121db93
payment_request_id
string

Xendit unique Payment Request ID generated as reference after creation of payment request.

Examplepr-1102feb0-bb79-47ae-9d1e-e69394d3949c
payment_id
string

To be deprecated. Xendit unique Payment ID generated as reference for a payment.

Examplepy-1402feb0-bb79-47ae-9d1e-e69394d3949c
invoice_id
string

To be deprecated. Xendit unique Invoice ID generated as reference after creation of an invoice or payment link.

Example65fc7522ff846905c2fc1c8d
payment_method_type
string

To be deprecated. Type of the payment method used in the original payment.'

Valid values[ "CARD", "EWALLET", "DIRECT_DEBIT" ]
reference_id
string

A Reference ID from merchants to identify their request.

Min length1
Max length255
channel_code
string

Channel code used to select the payment method provider. Use routing payment channels mapping for full list of channel codes.

currency
string

ISO 4217 three-letter currency code for the payment.

Valid values[ "IDR", "PHP", "VND", "THB", "SGD", "MYR", "USD" ]
ExampleIDR
amount
number

The intended payment amount to be refunded to the end user.

Minimum0.0
Example10000
status
string

Status of the refund.

Valid values[ "SUCCEEDED", "FAILED", "PENDING", "CANCELLED" ]
reason
string

Status of the refund.

Valid values[ "FRAUDULENT", "DUPLICATE", "REQUESTED_BY_CUSTOMER", "CANCELLATION", "OTHERS" ]
failure_code
string

Reasons of the refund failure.

Valid values[ "ACCOUNT_ACCESS_BLOCKED", "ACCOUNT_NOT_FOUND", "DUPLICATE_ERROR", "INSUFFICIENT_BALANCE", "REFUND_FAILED" ]
refund_fee_amount
number

Fee for processing the refund

metadata
object (Payments_API_MerchantMetadata)

Key-value entries for your custom data. You can specify up to 50 keys, with key names up to 40 characters and values up to 500 characters. This is for your convenience. Xendit will not use this data for any processing.

Example{ "my_custom_id": "merchant-123", "my_custom_order_id": "order-123" }
created
string (date-time)

ISO 8601 date-time format.

Example2021-12-31T23:59:59Z
updated
string (date-time)

ISO 8601 date-time format.

Example2021-12-31T23:59:59Z
400

Bad request

OneOf
Payments_API_Http400InvalidValueError
object (Payments_API_Http400InvalidValueError)
error_code
string
Valid values[ "INVALID_VALUE_ERROR" ]
message
string

Values in the payment request is not within expected range or expected configurations. Check the specific error message for debugging.

Payments_API_Http400ApiValidationError
object (Payments_API_Http400ApiValidationError)
error_code
string
Valid values[ "API_VALIDATION_ERROR" ]
message
string

Fields or values in the payment request does not comply with our API specification. Check the specific error message for debugging.

Payments_API_Http400RefundAmountExceeded
object (Payments_API_Http400RefundAmountExceeded)
error_code
string
Valid values[ "REFUND_AMOUNT_EXCEEDED" ]
message
string

Refund amount specified in refund request must be less than or equal to unrefunded capture amount.

Payments_API_Http400TemporarilyUnavailable
object (Payments_API_Http400TemporarilyUnavailable)
error_code
string
Valid values[ "TEMPORARILY_UNAVAILABLE" ]
message
string

Requested feature is unavailable during this timing.

Payments_API_Http400RefundInProgress
object (Payments_API_Http400RefundInProgress)
error_code
string
Valid values[ "REFUND_IN_PROGRESS" ]
message
string

Please wait for the pending refund request to be completed before initiating a new one.

Payments_API_Http400IneligibleTransactionStatus
object (Payments_API_Http400IneligibleTransactionStatus)
error_code
string
Valid values[ "INELIGIBLE_TRANSACTION_STATUS" ]
message
string

Feature is not allowed for the payment request because of its current status. Check the specific error message for debugging.

Payments_API_Http400InsufficientBalance
object (Payments_API_Http400InsufficientBalance)
error_code
string
Valid values[ "INSUFFICIENT_BALANCE" ]
message
string

There is insufficient balance in your account to perform a refund. Please top up your balance with a sufficient amount before retrying the refund.

Payments_API_Http400PartialRefundCountsExceeded
object (Payments_API_Http400PartialRefundCountsExceeded)
error_code
string
Valid values[ "PARTIAL_REFUND_COUNTS_EXCEEDED" ]
message
string

Number of partial refunds for this payment request has exceeded what is allowed by payment channel. Please check our documentations for refund limitations.

403

Forbidden

OneOf
Payments_API_Http403Skip3dsForbidden
object (Payments_API_Http403Skip3dsForbidden)
error_code
string
Valid values[ "SKIP_3DS_FORBIDDEN" ]
message
string

Non 3DS payment request for cards is not allowed. Please activate the feature on Xendit dashboard before proceeding.

Payments_API_Http403InvalidMerchantSettings
object (Payments_API_Http403InvalidMerchantSettings)
error_code
string
Valid values[ "INVALID_MERCHANT_SETTINGS" ]
message
string

Merchant credentials met with an error with the provider. Please contact Xendit customer support to resolve this issue.

Payments_API_Http403RefundNotSupported
object (Payments_API_Http403RefundNotSupported)
error_code
string
Valid values[ "REFUND_NOT_SUPPORTED" ]
message
string

Refund feature is not available for this payment channel.

Payments_API_Http403PartialRefundNotSupported
object (Payments_API_Http403PartialRefundNotSupported)
error_code
string
Valid values[ "PARTIAL_REFUND_NOT_SUPPORTED" ]
message
string

Partial Refund feature is not available for this payment channel.

404

Not found

OneOf
Payments_API_Http404DataNotFound
object (Payments_API_Http404DataNotFound)
error_code
string
Valid values[ "DATA_NOT_FOUND" ]
message
string

ID specified in request cannot be found.

500

Internal server error

OneOf
Payments_API_Http500ServerError
object (Payments_API_Http500ServerError)
error_code
string
Valid values[ "SERVER_ERROR" ]
message
string

An unexpected error occured, our team has been notified and will troubleshoot the issue

503

Service unavailable

OneOf
Payments_API_Http503ChannelUnavailable
object (Payments_API_Http503ChannelUnavailable)
error_code
string
Valid values[ "CHANNEL_UNAVAILABLE" ]
message
string

The channel requested is currently experiencing unexpected issues. The provider will be notified to resolve this issue.