Skip to main content

Order refunds

The order refunds API allows you to create, view, and delete individual refunds, based on an existing order.

Order refund properties

AttributeTypeDescription
idintegerUnique identifier for the resource. READ-ONLY
date_createddate-timeThe date the order refund was created, in the site's timezone. READ-ONLY
date_created_gmtdate-timeThe date the order refund was created, as GMT. READ-ONLY
amountstringTotal refund amount. Optional. If this parameter is provided, it will take precedence over line item totals, even when total of line items does not matches with this amount.
reasonstringReason for refund.
refunded_byintegerUser ID of user who created the refund.
refunded_paymentbooleanIf the payment was refunded via the API. See api_refund. READ-ONLY
meta_dataarrayMeta data. See Order refund - Meta data properties
line_itemsarrayLine items data. See Order refund - Line items properties
tax_linesarrayTax lines data. See Order refund - Tax lines properties READ-ONLY
shipping_linesarrayShipping lines data. See Order refund - Shipping lines properties
fee_linesarrayFee lines data. See Order refund - Fee lines properties
api_refundbooleanWhen true, the payment gateway API is used to generate the refund. Default is true. WRITE-ONLY
api_restockbooleanWhen true, the selected line items are restocked Default is true. WRITE-ONLY

Order refund - Meta data properties

AttributeTypeDescription
idintegerMeta ID. READ-ONLY
keystringMeta key.
valuestringMeta value.

Order refund - Line items properties

AttributeTypeDescription
idintegerItem ID. READ-ONLY
namestringProduct name.
product_idintegerProduct ID.
variation_idintegerVariation ID, if applicable.
quantityintegerQuantity ordered.
tax_classstringTax class of product.
subtotalstringLine subtotal (before discounts).
subtotal_taxstringLine subtotal tax (before discounts). READ-ONLY
totalstringLine total (after discounts).
total_taxstringLine total tax (after discounts). READ-ONLY
taxesarrayLine taxes. See Order refund line item - Taxes properties READ-ONLY
meta_dataarrayMeta data. See Order refund - Meta data properties
skustringProduct SKU. READ-ONLY
pricestringProduct price. READ-ONLY

Order refund line item - Taxes properties

AttributeTypeDescription
idintegerTax rate ID. READ-ONLY
totalstringTax total. READ-ONLY
subtotalstringTax subtotal. READ-ONLY

Order refund - Tax lines properties

AttributeTypeDescription
idintegerItem ID. READ-ONLY
rate_codestringTax rate code. READ-ONLY
rate_idintegerTax rate ID. READ-ONLY
labelstringTax rate label. READ-ONLY
compoundbooleanWhether or not this is a compound tax rate. READ-ONLY
tax_totalstringTax total (not including shipping taxes). READ-ONLY
shipping_tax_totalstringShipping tax total. READ-ONLY
meta_dataarrayMeta data. See Order refund - Meta data properties

Order refund - Shipping lines properties

AttributeTypeDescription
idintegerItem ID. READ-ONLY
method_titlestringShipping method name.
method_idstringShipping method ID.
totalstringLine total (after discounts).
total_taxstringLine total tax (after discounts). READ-ONLY
taxesarrayLine taxes. See Order refund - Tax lines properties READ-ONLY
meta_dataarrayMeta data. See Order refund - Meta data properties

Order refund - Fee lines properties

AttributeTypeDescription
idintegerItem ID. READ-ONLY
namestringFee name.
tax_classstringTax class of fee.
tax_statusstringTax status of fee. Options: taxable and none.
totalstringLine total (after discounts).
total_taxstringLine total tax (after discounts). READ-ONLY
taxesarrayLine taxes. See Order refund - Tax lines properties READ-ONLY
meta_dataarrayMeta data. See Order refund - Meta data properties

Create a refund

This API helps you to create a new refund for an order.

POST /wp-json/wc/v3/orders/<id>/refunds
curl -X POST https://example.com/wp-json/wc/v3/orders/723/refunds \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"amount": "30",
"line_items": [
{
"id": "111",
"refund_total": 10,
"refund_tax": [
{
"id": "222",
"refund_total": 20
}
]
}
}'

Line item parameters

ParameterTypeDescription
idintegerThe ID of the line item in the order.
refund_totalnumberThe amount to refund for this line item, excluding taxes.
refund_taxarrayRefunds for tax rates. See Refund tax parameters

Refund tax parameters

ParameterTypeDescription
idintegerThe ID of the tax rate.
refund_totalnumberThe amount of tax to refund for this line item.

Retrieve a refund

This API lets you retrieve and view a specific refund from an order.

GET /wp-json/wc/v3/orders/<id>/refunds/<refund_id>
curl https://example.com/wp-json/wc/v3/orders/723/refunds/726 \
-u consumer_key:consumer_secret

Available parameters

ParameterTypeDescription
dpstringNumber of decimal points to use in each resource.

List all refunds

This API helps you to view all the refunds from an order.

Note: To view a list of refunds from your store, regardless of order, check out the refunds endpoint.

GET /wp-json/wc/v3/orders/<id>/refunds
curl https://example.com/wp-json/wc/v3/orders/723/refunds \
-u consumer_key:consumer_secret

Available parameters

ParameterTypeDescription
contextstringScope under which the request is made; determines fields present in response. Options: view and edit. Default is view.
pageintegerCurrent page of the collection. Default is 1.
per_pageintegerMaximum number of items to be returned in result set. Default is 10.
searchstringLimit results to those matching a string.
afterstringLimit response to resources published after a given ISO8601 compliant date.
beforestringLimit response to resources published before a given ISO8601 compliant date.
dates_are_gmtbooleanInterpret after and before as UTC dates when true.
excludearrayEnsure result set excludes specific IDs.
includearrayLimit result set to specific ids.
offsetintegerOffset the result set by a specific number of items.
orderstringOrder sort attribute ascending or descending. Options: asc and desc. Default is desc.
orderbystringSort collection by object attribute. Options: date, modified, id, include, title and slug. Default is date.
parentarrayLimit result set to those of particular parent IDs.
parent_excludearrayLimit result set to all items except those of a particular parent ID.
dpintegerNumber of decimal points to use in each resource. Default is 2.

Delete a refund

This API helps you delete an order refund.

DELETE /wp-json/wc/v3/orders/<id>/refunds/<refund_id>
curl -X DELETE https://example.com/wp-json/wc/v3/orders/723/refunds/726?force=true \
-u consumer_key:consumer_secret

Available parameters

ParameterTypeDescription
forcestringRequired to be true, as resource does not support trashing.