Refund API (item level) (1.0.0)
Download OpenAPI specification:Download
Represents a refund request, triggered by a return or appeasement. It can be applied to all or specific items of an order. If needed, shipping costs can be refunded as well.
A refund request can be pending, successful, or failed. A successful refund request may depend on the captured amount and on previous refunds (pending and successful).
Related resources:
List refund requests
Retrieves the list of refund requests for the specified order ordered by ascending creation dates. The list is empty when no refunds have been requested for this order.
Use the Get refund request details method to get more information about each refund request.
Authorizations:
path Parameters
id required | string The identifier of the order. To retrieve the order ID, use the List orders method. |
Responses
Response samples
- 200
- 500
{- "refunds": [
- {
- "id": "28d07ccd-c609-46cf-bd52-c43ef70737d5",
- "revision": 1,
- "created_at": "2018-10-25T10:18:09.815041Z",
- "updated_at": "2018-10-25T10:18:09.815041Z",
- "order_id": "91207347-47b6-4b21-b736-5fe9ec82e9ea",
- "amount": 90.3,
- "type": "percentage",
- "value": 100,
- "currency": "USD",
- "reason_code": 2,
- "reason": "Item is damaged",
- "note": "The white shirt has yellow stains on it",
- "requested_at": "2018-10-25T10:18:09.783315Z",
- "user_id": "22IB3UROr1S3Je9hDaRh7f",
- "user_email": "johndoe@example.com",
- "status": "succeeded",
- "is_historical": false,
- "metadata": {
- "extended_attributes": [
- {
- "name": "somekey1",
- "value": "somevalue1"
}, - {
- "name": "somekey2",
- "value": "somevalue2"
}
]
}, - "items": [
- {
- "type": "product",
- "id": "6f38b75f-3fb3-4454-975d-af0cb412f8fa",
- "refund": {
- "net": 60,
- "tax": 6.65,
- "gross": 66.65
}
}, - {
- "type": "shipping",
- "id": "2728c174-719d-47c3-bd5e-51ec470180fe",
- "refund": {
- "net": 22,
- "tax": 1.65,
- "gross": 23.65
}
}
]
}
]
}
Create refund request
Creates a refund request to initiate a refund. This call is asynchronous. A successful response means that the refund request was accepted and will be executed after there are enough captured funds.
Note: When the refund request is successful, an email is sent to the customer if you provided their email address. No email is sent for historical refund requests.
Note: In case of fixed type request the refund amount will be pro-rated across all specified items. Example: Request
Refund 50$ from items:
Item ID | Price paid |
---|---|
Item 1 | $50 |
Item 2 | $75 |
Item 3 | $25 |
Total | $150 |
Response
Item ID | Refunded amount | Details |
---|---|---|
Item 1 | $16.67 | 50 / (50 + 75 + 25) * 50 = 16.67 |
Item 2 | $25 | 75 / (50 + 75 + 25) * 50 = 25 |
Item 3 | $8.33 | 25 / (50 + 75 + 25) * 50 = 8.33 |
Total refund amount | $50 |
Authorizations:
path Parameters
id required | string The identifier of the order. To retrieve the order ID, use the List orders method. |
Request Body schema: application/json
return_id | string = 36 characters Identifier for the corresponding return if any. |
value required | number >= 0 The percentage of the refund if the type is percentage or the monetary amount if it's fixed. |
type required | string Enum: "percentage" "fixed" The type of the refund it's either percentage or fixed. |
currency required | string = 3 characters The currency this refund was issued in. |
reason_code | integer The corresponding code for the return reason. |
reason | string The reason why this refund was requested. |
note | string Additional note for the refund reason. |
string <email> Customer Email address to which a refund note will be sent in case of success. Email is not sent for historical refund requests. | |
requested_at | string <date-time> The time when the refund was requested. |
Array of objects <= 100 items Additional information about the refund request passed as metadata, without any processing logic associated with it in NewStore. For example, the payment provider for the refund. | |
is_historical | boolean Set to true if the refund request was imported from an external system and was already processed and the money was refunded. |
required | Array of objects or objects non-empty A list of product and/or shipping items that should be refunded. |
Responses
Request samples
- Payload
{- "value": 50,
- "currency": "USD",
- "type": "percentage",
- "reason_code": 2,
- "reason": "Item is damaged",
- "note": "The white shirt has yellow stains on it",
- "email": "johndoe@example.com",
- "is_historical": false,
- "items": [
- {
- "id": "6f38b75f-3fb3-4454-975d-af0cb412f8fa",
- "type": "product"
}, - {
- "type": "shipping"
}
]
}
Response samples
- 201
- 400
- 500
{- "id": "192bb646-fff2-4a2f-bbb5-afcd5c491cc9"
}
Get refund request
Retrieves the refund request details of the provided refund request identifier, for the specified order.
Authorizations:
path Parameters
refund_id required | string The identifier of the refund. |
id required | string The identifier of the order. |
Responses
Response samples
- 200
- 404
- 500
{- "refund": {
- "id": "28d07ccd-c609-46cf-bd52-c43ef70737d5",
- "revision": 1,
- "created_at": "2018-10-25T10:18:09.815041Z",
- "updated_at": "2018-10-25T10:18:09.815041Z",
- "order_id": "91207347-47b6-4b21-b736-5fe9ec82e9ea",
- "amount": 90.3,
- "currency": "USD",
- "value": 100,
- "type": "percentage",
- "reason_code": 2,
- "reason": "Item is damaged",
- "note": "The white shirt has yellow stains on it",
- "requested_at": "2018-10-25T10:18:09.783315Z",
- "user_id": "22IB3UROr1S3Je9hDaRh7f",
- "user_email": "johndoe@example.com",
- "status": "succeeded",
- "refund_level": "item_level",
- "is_historical": false,
- "metadata": {
- "extended_attributes": [
- {
- "name": "somekey1",
- "value": "somevalue1"
}, - {
- "name": "somekey2",
- "value": "somevalue2"
}
]
}, - "items": [
- {
- "type": "product",
- "id": "6f38b75f-3fb3-4454-975d-af0cb412f8fa",
- "refund": {
- "net": 60,
- "tax": 6.65,
- "gross": 66.65
}
}, - {
- "type": "shipping",
- "id": "2728c174-719d-47c3-bd5e-51ec470180fe",
- "refund": {
- "net": 22,
- "tax": 1.65,
- "gross": 23.65
}
}
]
}
}
Calculate refund amount
Calculates the total refund amount for the requested items (product or shipping) that will be applied when creating a refund request. The amount is rounded according to the currency the customer used to pay the order.
Authorizations:
path Parameters
id required | string The identifier of the order. To retrieve the order ID, use the List orders method. |
Request Body schema: application/json
value required | number The percentage value that should be applied as a refund, e.g. 50.0 means a 50% refund will be applied. |
required | Array of objects or objects non-empty A list of product and/or shipping items that should be refunded. |
Responses
Request samples
- Payload
{- "value": 50,
- "items": [
- {
- "type": "product",
- "id": "927c702a-3cb1-48c1-9189-554bf9d0fde7"
}, - {
- "type": "shipping"
}
]
}
Response samples
- 200
- 400
- 404
- 500
{- "refund": {
- "gross": 120
}, - "items": [
- {
- "id": "927c702a-3cb1-48c1-9189-554bf9d0fde7",
- "type": "product",
- "refund": {
- "gross": 96
}
}, - {
- "id": "7b1d4a63-c97f-4ca9-8771-9464c1d86fea",
- "type": "shipping",
- "refund": {
- "gross": 12
}
}, - {
- "id": "3e679ff2-296c-4886-aa8e-c85124621d3a",
- "type": "shipping",
- "refund": {
- "gross": 12
}
}
]
}