Order refunds
The ATUM order refunds API allows you to view the refunds of all the WooCommerce orders at once, without having to request them order by order.
WooCommerce's order refunds endpoint (/wp-json/wc/v3/orders/<order_id>/refunds) only lists the refunds of one order. This ATUM endpoint lists the refunds of every order and adds the ID of the refunded order (parent_id) to each of them. It's read-only: to create or delete refunds, use the WooCommerce endpoint.
Only the refunds of WooCommerce orders are returned. Requesting a refund that belongs to another type of order returns the atum_rest_invalid_order_refund_id error (404).
Order refund properties
| Attribute | Type | Description |
|---|---|---|
id | integer | Unique identifier for the resource. read-only |
parent_id | integer | ID of the refunded order. read-only |
date_created | date-time | The date the order refund was created, in the site's timezone. read-only |
date_created_gmt | date-time | The date the order refund was created, as GMT. read-only |
amount | string | Refund amount. read-only |
reason | string | Reason for refund. read-only |
refunded_by | integer | User ID of user who created the refund. read-only |
refunded_payment | boolean | If the payment was refunded via the API. read-only |
meta_data | array | Meta data. See Order refund - Meta data properties read-only |
line_items | array | Line items data. See Order refund - Line items properties read-only |
shipping_lines | array | Shipping lines data. Same properties as the order's shipping lines. read-only |
tax_lines | array | Tax lines data. Same properties as the order's tax lines. read-only |
fee_lines | array | Fee lines data. Same properties as the order's fee lines. read-only |
cost_of_goods_sold | object | Cost of Goods Sold data (total_value). Only included when the WooCommerce's Cost of Goods Sold feature is enabled. read-only |
Order refund - Meta data properties
| Attribute | Type | Description |
|---|---|---|
id | integer | Meta ID. read-only |
key | string | Meta key. read-only |
value | mixed | Meta value. read-only |
Order refund - Line items properties
The amounts and quantities of the refunded items are negative.
| Attribute | Type | Description |
|---|---|---|
id | integer | Item ID. read-only |
name | string | Product name. read-only |
product_id | integer | Product ID. read-only |
variation_id | integer | Variation ID, if applicable. read-only |
quantity | integer | Quantity refunded. read-only |
tax_class | string | Tax class of product. read-only |
subtotal | string | Line subtotal (before discounts). read-only |
subtotal_tax | string | Line subtotal tax (before discounts). read-only |
total | string | Line total (after discounts). read-only |
total_tax | string | Line total tax (after discounts). read-only |
taxes | array | Line taxes. See Order refund - Taxes properties read-only |
meta_data | array | Meta data, including display_key and display_value. The _refunded_item_id meta holds the ID of the refunded order item. read-only |
sku | string | Product SKU. read-only |
global_unique_id | string | Product's GTIN, UPC, EAN or ISBN. read-only |
price | number | Product price. read-only |
image | object | Product image (id and src). read-only |
parent_name | string | Parent product name, if the product is a variation. read-only |
Order refund - Taxes properties
| Attribute | Type | Description |
|---|---|---|
id | integer | Tax rate ID. read-only |
total | string | Tax total. read-only |
subtotal | string | Tax subtotal. read-only |
Retrieve an order refund
This API lets you retrieve and view a specific refund by its ID, without knowing the order it belongs to.
HTTP request
/wp-json/wc/v3/atum/order-refunds/<id>curl https://example.com/wp-json/wc/v3/atum/order-refunds/731 \
-u consumer_key:consumer_secret{
"id": 731,
"date_created": "2019-03-25T10:12:40",
"date_created_gmt": "2019-03-25T13:12:40",
"amount": "3.23",
"reason": "Damaged item",
"refunded_by": 1,
"refunded_payment": false,
"meta_data": [],
"line_items": [
{
"id": 320,
"name": "Woo Single #1",
"product_id": 93,
"variation_id": 0,
"quantity": -1,
"tax_class": "",
"subtotal": "-3.00",
"subtotal_tax": "-0.23",
"total": "-3.00",
"total_tax": "-0.23",
"taxes": [
{
"id": 75,
"total": "-0.23",
"subtotal": "-0.23"
}
],
"meta_data": [
{
"id": 2210,
"key": "_refunded_item_id",
"value": "315",
"display_key": "_refunded_item_id",
"display_value": "315"
}
],
"sku": "",
"global_unique_id": "",
"price": 3,
"image": {
"id": 0,
"src": ""
},
"parent_name": null
}
],
"shipping_lines": [],
"tax_lines": [
{
"id": 321,
"rate_code": "US-CA-STATE TAX",
"rate_id": 75,
"label": "State Tax",
"compound": false,
"tax_total": "-0.23",
"shipping_tax_total": "0.00",
"rate_percent": 7.5,
"meta_data": []
}
],
"fee_lines": [],
"parent_id": 727,
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/atum/order-refunds/731"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/atum/order-refunds"
}
],
"up": [
{
"href": "https://example.com/wp-json/wc/v3/orders/727"
}
]
}
}Available parameters
| Parameter | Type | Description |
|---|---|---|
context | string | Scope under which the request is made; determines fields present in response. Options: view and edit. Default is view. |
dp | integer | Number of decimal points to use in each resource. Default is the store's number of decimals. |
List all order refunds
This API helps you to view all the refunds of all the WooCommerce orders.
HTTP request
/wp-json/wc/v3/atum/order-refundscurl https://example.com/wp-json/wc/v3/atum/order-refunds \
-u consumer_key:consumer_secret[
{
"id": 731,
"date_created": "2019-03-25T10:12:40",
"date_created_gmt": "2019-03-25T13:12:40",
"amount": "3.23",
"reason": "Damaged item",
"refunded_by": 1,
"refunded_payment": false,
"meta_data": [],
"line_items": [
{
"id": 320,
"name": "Woo Single #1",
"product_id": 93,
"variation_id": 0,
"quantity": -1,
"tax_class": "",
"subtotal": "-3.00",
"subtotal_tax": "-0.23",
"total": "-3.00",
"total_tax": "-0.23",
"taxes": [
{
"id": 75,
"total": "-0.23",
"subtotal": "-0.23"
}
],
"meta_data": [
{
"id": 2210,
"key": "_refunded_item_id",
"value": "315",
"display_key": "_refunded_item_id",
"display_value": "315"
}
],
"sku": "",
"global_unique_id": "",
"price": 3,
"image": {
"id": 0,
"src": ""
},
"parent_name": null
}
],
"shipping_lines": [],
"tax_lines": [
{
"id": 321,
"rate_code": "US-CA-STATE TAX",
"rate_id": 75,
"label": "State Tax",
"compound": false,
"tax_total": "-0.23",
"shipping_tax_total": "0.00",
"rate_percent": 7.5,
"meta_data": []
}
],
"fee_lines": [],
"parent_id": 727,
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/atum/order-refunds/731"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/atum/order-refunds"
}
],
"up": [
{
"href": "https://example.com/wp-json/wc/v3/orders/727"
}
]
}
},
{
"id": 726,
"date_created": "2019-03-21T18:05:11",
"date_created_gmt": "2019-03-21T21:05:11",
"amount": "10.00",
"reason": "",
"refunded_by": 1,
"refunded_payment": false,
"meta_data": [],
"line_items": [],
"shipping_lines": [
{
"id": 312,
"method_title": "Flat Rate",
"method_id": "flat_rate",
"instance_id": "1",
"total": "-10.00",
"total_tax": "0.00",
"taxes": [],
"meta_data": [
{
"id": 2188,
"key": "_refunded_item_id",
"value": "309",
"display_key": "_refunded_item_id",
"display_value": "309"
}
]
}
],
"tax_lines": [],
"fee_lines": [],
"parent_id": 723,
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/atum/order-refunds/726"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/atum/order-refunds"
}
],
"up": [
{
"href": "https://example.com/wp-json/wc/v3/orders/723"
}
]
}
}
]Available parameters
| Parameter | Type | Description |
|---|---|---|
context | string | Scope under which the request is made; determines fields present in response. Options: view and edit. Default is view. |
page | integer | Current page of the collection. Default is 1. |
per_page | integer | Maximum number of items to be returned in result set. Default is 10. Maximum is 100. |
search | string | Limit results to those matching a string. |
after | string | Limit response to resources created after a given ISO8601 compliant date. |
before | string | Limit response to resources created before a given ISO8601 compliant date. |
modified_after | string | Limit response to resources modified after a given ISO8601 compliant date. |
modified_before | string | Limit response to resources modified before a given ISO8601 compliant date. |
dates_are_gmt | boolean | Whether to consider GMT dates when limiting response by created or modified date. Default is false. |
exclude | array | Ensure result set excludes specific IDs. |
include | array | Limit result set to specific IDs. |
offset | integer | Offset the result set by a specific number of items. |
order | string | Order sort attribute ascending or descending. Options: asc and desc. Default is desc. |
orderby | string | Sort collection by object attribute. Options: date, id, include, title, slug and modified. Default is date. |
parent | array | Limit result set to those of particular parent IDs. Currently ignored by this endpoint: to get the refunds of specific orders, use WooCommerce's /orders/<order_id>/refunds endpoint. |
parent_exclude | array | Limit result set to all items except those of particular parent (order) IDs. |
dp | integer | Number of decimal points to use in each resource. Default is 2. |
order_item_display_meta | boolean | Only show meta which is meant to be displayed for an order. Default is false. |
include_meta | array | Limit meta_data to specific keys. Inherited from the orders endpoint, it doesn't filter the refunds' meta data. |
exclude_meta | array | Ensure meta_data excludes specific keys. Inherited from the orders endpoint, it doesn't filter the refunds' meta data. |