Refunds

Learn how to use the Refunds resource.

The Refunds resource allows you to:

Create a refund for an order

To refund all or part of an order charge, create a refund for the orderId.

Request header example
POST https://api.digitalriver.com/refunds
Authorization:[basic {secret key}]
Accept:[application/json]

Include the refund information in the body like this:

Request body example
{
"orderId": "ord_6645940010",
"currency": "USD",
"type": "shipping",
"percent": 100,
"reason": "requested_by_customer"
}

Use the refund type to identify what charge you want to refund. You can specify one of the following values for the type:

  • shipping–refunds the shipping.

  • tax–refunds the tax.

  • fees–refunds the fees.

You may provide a reason code for the refund.

A successful request returns the Refund object:

Refund object example
{
"id": "ref_5823594809",
"createdTime": "2018-04-25T20:36:00Z",
"orderId": "ord_6645940010",
"currency": "USD",
"items": [
{
"type": "shipping",
"amount": 5.95
}
],
"reason": "requested_by_customer",
"state": "created"
}

Return a list of all refunds

To retrieve a list of all refunds, send a request to retrieve the refunds:

Request header example
GET https://api.digitalriver.com/refunds
Authorization:[basic {secret key}]
Accept:[application/json]

A successful request returns a list of refunds:

Refund list example
{
"hasMore": false,
"data": [
{
"id": "ref_5823594809",
"createdTime": "2018-04-25T20:36:00Z",
"orderId": "ord_6645940010",
"currency": "USD",
"type": "shipping",
"amount": 9.99,
"refundedAmount": 9.99,
"items": [
[
{
"type": "shipping",
"skuId": "sku_9234276173",
"quantity": 1,
"amount": 5.95
}
]
],
"reason": "requested_by_customer",
"failureReason": "expired_or_canceled_card",
"state": "created",
"liveMode": false
}
]
}

Retrieve a refund by ID

To retrieve a refund, get the refund by ID.

Request header example
GET https://api.digitalriver.com/refunds/:ref_5823594809
Authorization:[basic {secret key}]
Accept:[application/json]

A successful request returns the Refund object:

Refund object example
{
"id": "ref_5823594809",
"createdTime": "2018-04-25T20:36:00Z",
"orderId": "ord_6645940010",
"currency": "USD",
"type": "shipping",
"amount": 9.99,
"refundedAmount": 9.99,
"items": [
[
{
"type": "shipping",
"skuId": "sku_9234276173",
"quantity": 1,
"amount": 5.95
}
]
],
"reason": "requested_by_customer",
"state": "created",
"liveMode": false
}

Refund reason codes

Reason codes are arbitrary, searchable strings you may use to capture the reason for the refund.