Skip to main content

Refunds

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

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
amountstringRefund amount. REQUIRED
reasonstringReason for refund.
line_itemsarrayLine items data. See Refunds Line Items properties.

Refund line item properties

AttributeTypeDescription
idintegerItem ID. READ-ONLY
namestringProduct name. READ-ONLY
skustringProduct SKU. READ-ONLY
product_idintegerProduct ID.
variation_idintegerVariation ID, if applicable.
quantityintegerQuantity ordered.
tax_classstringTax class of product. READ-ONLY
pricestringProduct price. READ-ONLY
subtotalstringLine subtotal (before discounts).
subtotal_taxstringLine subtotal tax (before discounts).
totalstringLine total (after discounts).
total_taxstringLine total tax (after discounts).
taxesarrayLine total tax with id, total and subtotal. READ-ONLY
metaarrayLine item meta data with key, label and value. READ-ONLY

Create a refund

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

POST /wp-json/wc/v1/orders/<id>/refunds
curl -X POST https://example.com/wp-json/wc/v1/orders/116/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/v1/orders/<id>/refunds/<refund_id>
curl https://example.com/wp-json/wc/v1/orders/116/refunds/150 \
-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.

GET /wp-json/wc/v1/orders/<id>/refunds
curl https://example.com/wp-json/wc/v1/orders/116/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.
pageintegerCurrent page of the collection.
per_pageintegerMaximum number of items to be returned in result set.
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.
excludestringEnsure result set excludes specific ids.
includestringLimit result set to specific ids.
offsetintegerOffset the result set by a specific number of items.
orderstringOrder sort attribute ascending or descending. Default is asc. Options: asc and desc.
orderbystringSort collection by object attribute. Default is date, Options: date, id, include, title and slug.
dpstringNumber of decimal points to use in each resource.

Delete a refund

This API helps you delete an order refund.

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

Available parameters

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