Order Refunds

On this page, we'll dive into the different order refund endpoints you can use to manage refunds programmatically.

The refund model

The refund model contains all the information about order refunds, including the refund lines, amounts, and tax information.

Properties

NameTypeDescription
idstringUnique identifier for the refund (starts with refund_).
resourcestringThe resource type. Always refund.
orderIdstring | nullID of the credit note order created for this refund. Always present; null until the refund is processed.
customerIdstringID of the customer receiving the refund.
testmodebooleanWhether this refund is in test mode.
statusstringThe current status of the refund. Can be pending, queued, processing, refunded, failed, or canceled.
originalOrderIdstringID of the original order being refunded.
totalMoneyTotal refund amount including taxes. A Money object with value (decimal string) and currency (ISO 4217 code).
subtotalMoneyRefund subtotal before taxes.
taxSummaryarrayTax breakdown by rate being refunded. Array of objects with taxRate (name, percentage, taxablePercentage) and amount (Money).
linesarrayArray of refund line items. See RefundLine properties below.
metadataobject | nullThe metadata sent when the refund was created. Always present; null when none was sent, including for refunds created before Vatly stored refund metadata.
createdAtstringWhen this refund was created (ISO 8601 format).
linksobjectHATEOAS links to related resources. Contains self, originalOrder, order (the credit note order) and customerInvoice (the credit note in the customer portal, text/html). order and customerInvoice are always present and are null until the refund is processed. The customerInvoice link is signed and expires after 72 hours; the customer can request a new one from the page.

Status values

StatusDescription
pendingRefund is ready to be sent to the bank.
queuedRefund is queued due to a lack of balance.
processingRefund is being processed (cancellation no longer possible).
refundedRefund has been processed successfully.
failedRefund has failed after processing.
canceledRefund was canceled.

RefundLine Properties

NameTypeDescription
idstringUnique identifier for this refund line (starts with refund_item_).
resourcestringThe resource type. Always refundline.
descriptionstringDescription of the refunded item.
quantityintegerAlways 1 on a partial refund: the line refunds an amount (basePrice), not a number of units.
basePriceMoneyRefund amount before taxes.
totalMoneyTotal refund amount including taxes.
subtotalMoneyRefund subtotal before taxes.
taxesarrayTax breakdown by rate being refunded. Array of objects with taxRate and amount.
originalOrderLineIdstring | nullThe id of the line on the original order (originalOrderId) that this refund line reverses. This is the same value you pass as itemId when creating a refund. Set on every refund line, including those created before this field existed.
productTypestring | nullThe productType of that original order line: one_off_product, subscription_plan, subscription, billing_details_verification, auth_request_product, or null.
productIdstring | nullThe productId of that original order line. null when that line has no product.

To find out which product a refund was for, for example to revoke access to it, read productType and productId on each refund line. They are included in refund.* webhooks too.


Create a refund

POST /v1/orders/:orderId/refunds

This endpoint allows you to create a partial refund for a specific order. You specify which order line items to refund and the amount for each.

Only sales can be refunded: checkout and subscription orders. Refunding any other order type, such as a payment-method authorization request (auth_request) or a billing-details verification charge (update_details_order), returns 422 with the standard error shape. details.orderType names the order's type and is informational only:

{
  "message": "Orders of type `auth_request` are not sales and cannot be refunded. Only checkout and subscription orders can be refunded.",
  "details": {
    "orderType": "auth_request"
  }
}

The order's refundableSubtotal is always zero for such orders.

If another refund of the same order is still being created, the request returns 409 with details.retry_with_new_idempotency_key set to true. Retry with a new Idempotency-Key. See Understanding 409 Conflict.

Parameters

NameTypeDescription
orderIdstringThe unique identifier of the order.

Request body

NameTypeDescription
itemsarray(Required) Array of items to refund. Each item has: itemId (string, required) - ID of the order line item, amount (Money, required) - amount to refund before taxes, description (string, optional) - custom description, descriptionAdditionalLine (string, optional) - additional description line.
metadataobject | nullArbitrary key-value metadata for your application: an object with string values, up to 50 keys, key names up to 40 characters and values up to 500 characters. Anything else returns 422. null is treated as omitted.
curl -X POST https://api.vatly.com/v1/orders/order_Fp2kQrSvWm8NjLhYbUcP/refunds \
  -H "Authorization: Bearer live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {
        "itemId": "order_item_Jk4pQrSvWm8NjLhYbUcP",
        "amount": {
          "value": "15.00",
          "currency": "EUR"
        },
        "description": "50% refund for service issue"
      }
    ],
    "metadata": {
      "ticketId": "SUPPORT-12345"
    }
  }'

Create a full refund

POST /v1/orders/:orderId/refunds/full

This endpoint allows you to create a full refund for a specific order. This will refund the entire remaining amount of the order.

Only sales can be refunded: checkout and subscription orders. Refunding any other order type, such as a payment-method authorization request (auth_request) or a billing-details verification charge (update_details_order), returns 422 with the standard error shape. details.orderType names the order's type and is informational only:

{
  "message": "Orders of type `auth_request` are not sales and cannot be refunded. Only checkout and subscription orders can be refunded.",
  "details": {
    "orderType": "auth_request"
  }
}

The order's refundableSubtotal is always zero for such orders.

If another refund of the same order is still being created, the request returns 409 with details.retry_with_new_idempotency_key set to true. Retry with a new Idempotency-Key. See Understanding 409 Conflict.

Parameters

NameTypeDescription
orderIdstringThe unique identifier of the order.

Request body (optional)

NameTypeDescription
metadataobject | nullArbitrary key-value metadata for your application: an object with string values, up to 50 keys, key names up to 40 characters and values up to 500 characters. Anything else returns 422. null is treated as omitted.
curl -X POST https://api.vatly.com/v1/orders/order_Fp2kQrSvWm8NjLhYbUcP/refunds/full \
  -H "Authorization: Bearer live_your_api_key_here"

List order refunds

GET /v1/orders/:orderId/refunds

This endpoint allows you to retrieve a list of all refunds for a specific order.

Parameters

NameTypeDescription
orderIdstringThe unique identifier of the order.
limitintegerThe number of refunds to return (default: 10, max: 100).
startingAfterstringA cursor for use in pagination. Returns results after this refund ID.
endingBeforestringA cursor for use in pagination. Returns results before this refund ID.
curl https://api.vatly.com/v1/orders/order_Fp2kQrSvWm8NjLhYbUcP/refunds \
  -H "Authorization: Bearer live_your_api_key_here"

Get an order refund

GET /v1/orders/:orderId/refunds/:refundId

This endpoint allows you to retrieve details of a specific refund for a specific order.

Parameters

NameTypeDescription
orderIdstringThe unique identifier of the order.
refundIdstringThe unique identifier of the refund.
curl https://api.vatly.com/v1/orders/order_Fp2kQrSvWm8NjLhYbUcP/refunds/refund_Xk9pQrSvWm4NjLhYbUcP \
  -H "Authorization: Bearer live_your_api_key_here"

Cancel an order refund

DELETE /v1/orders/:orderId/refunds/:refundId

This endpoint allows you to cancel a pending refund for a specific order. Only pending refunds can be cancelled.

Parameters

NameTypeDescription
orderIdstringThe unique identifier of the order.
refundIdstringThe unique identifier of the refund to cancel.
curl -X DELETE https://api.vatly.com/v1/orders/order_Fp2kQrSvWm8NjLhYbUcP/refunds/refund_Mn6xBtPvKw2RjTgYcZaE \
  -H "Authorization: Bearer live_your_api_key_here"

Returns 204 No Content on success.

Copyright © 2026