Skip to main content

Refunds

The refunds API allows you to create, view, and delete individual refunds.

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
amountstringRefund amount.
reasonstringReason for refund.
refunded_byintegerUser ID of user who created the refund.
meta_dataarrayMeta data. See Order refund - Meta data properties
line_itemsarrayLine items data. See Order refund - Line items properties
api_refundbooleanWhen true, the payment gateway API is used to generate the refund. 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

Create a refund

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

POST /wp-json/wc/v2/orders/<id>/refunds
curl -X POST https://example.com/wp-json/wc/v2/orders/723/refunds \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"amount": "10"
}'

Retrieve a refund

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

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

Available parameters

ParameterTypeDescription
dpintegerNumber of decimal points to use in each resource.

List all refunds

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

GET /wp-json/wc/v2/orders/<id>/refunds
curl https://example.com/wp-json/wc/v2/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, 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/v2/orders/<id>/refunds/<refund_id>
curl -X DELETE https://example.com/wp-json/wc/v2/orders/723/refunds/726?force=true \
-u consumer_key:consumer_secret

Available parameters

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