latestOpenAPI 3.0.12026-08-101292701.1 MB

f21981db32be

Refunds

Creates a refund for an order

Refunds all all or part of an order charge.

post/refunds

Request body

orderIdstring

The unique identifier of the order. You are required to provide this parameter or <code>invoiceId</code>.

invoiceIdstring

The unique identifier of the invoice. You are required to provide this parameter or <code>orderId</code>.

currencystring required

Three-letter ISO currency code.

amountnumber double nullable

The amount to refund. You are required to provide this value, <code>percent</code>, or <code>items</code>.

percentnumber double nullable

The percent to refund. You are required to provide this value, <code>amount</code>, or <code>items</code>.

type'shipping' | 'duty' | 'tax' | 'importer_tax'

The type of the refund.

reasonstring

The reason for the refund.

metadataMetadata

Key-value pairs used to store additional data. Value can be string, boolean or integer types.

Example request

{
  "orderId": "ord_5823594809",
  "invoiceId": "5823594809",
  "currency": "USD",
  "amount": 9.99,
  "percent": 100,
  "type": "shipping",
  "items": [
    {
      "type": "shipping",
      "skuId": "sku_5823594809",
      "quantity": 1,
      "amount": 5.95,
      "percent": 100
    }
  ],
  "reason": "requested_by_customer",
  "metadata": {
    "coupon": "iOS"
  }
}

Response

201 Created

idstring

The unique identifier of the refund.

createdTimestring date-time

Time at which the refund was created.

orderIdstring

The unique identifier of the order.

invoiceIdstring

The unique identifier of the invoice.

currencystring

Three-letter ISO currency code.

type'shipping' | 'tax' | 'duty' | 'importer_tax'

The type of refund.

amountnumber double

The requested refund amount.

refundedAmountnumber double

The total amount refunded.

reasonstring

The reason for the refund.

failureReasonstring

The reason for the refund failure, if known.

state'pending_information' | 'pending' | 'succeeded' | 'failed' | 'expired'

The state of the refund.

expiresTimestring date-time

Time at which the information token expires.

liveModeboolean

Has the value true if the object exists in live mode or the value false if the object exists in test mode.

sourcestring

The source of the refund.

metadataMetadata

Key-value pairs used to store additional data. Value can be string, boolean or integer types.

Example response

{
  "id": "ref_5823594809",
  "createdTime": "2018-04-25T20:36:00Z",
  "orderId": "ord_6645940010",
  "invoiceId": "5823594809",
  "currency": "USD",
  "type": "shipping",
  "amount": 9.99,
  "refundedAmount": 9.99,
  "items": [
    {
      "type": "tax",
      "skuId": "sku_5823594809",
      "quantity": 1,
      "amount": 5.95,
      "percent": 10
    }
  ],
  "reason": "requested_by_customer",
  "failureReason": "expired_or_canceled_card",
  "state": "created",
  "tokenInformation": {
    "token": "bb3f0f17-567a-4c87-8cbd-76d93a750709",
    "expiresTime": "2019-12-25T20:36:00Z"
  },
  "expiresTime": "2019-12-25T20:36:00Z",
  "charges": [
    {
      "id": "c5b02ace-115d-4433-8841-8165d4c927a8",
      "refunds": [
        {
          "createdTime": "2018-04-25T20:36:00Z",
          "amount": 42.95,
          "state": "complete"
        }
      ],
      "sourceId": "376e6777-d92b-4d35-a460-44f29327a18e"
    }
  ],
  "source": "string",
  "metadata": {
    "coupon": "iOS"
  }
}