the line items included in the refund, along with restocking instructions

Before you create a refund, use the calculate endpoint to generate accurate refund transactions. Specify the line items that are being refunded, their quantity and restock instructions, and whether you're refunding shipping costs. You can then use the response in the body of the request to create the actual refund.

When you create a refund using the response from the calculate endpoint, you can set additional options, such as whether to notify the customer of the refund. You can refund less than the calculated amount for either shipping or the line items by setting a custom value for the amount property.

If a refund includes shipping costs, or if you choose to refund line items for less than their calculated amount, then an order adjustment is created automatically to account for the discrepancy in the store's financial reports.

What you can do with Refund

The Shopify API lets you do the following with the Refund resource. More detailed versions of these general actions may be available:

A list of order adjustments attached to the refund. Order adjustments are generated to account for refunded shipping costs and differences between calculated and actual refund amounts. Each entry has the following properties:

id: The unique identifier for the order adjustment.

order_id: The unique identifier for the order that the order adjustment is associated with.

refund_id: The unique identifier for the refund that the order adjustment is associated with.

amount: The value of the discrepancy between the calculated refund and the actual refund. If the kind property's value is shipping_refund, then amount returns the value of shipping charges refunded to the customer.

tax_amount: The taxes that are added to amount, such as applicable shipping taxes added to a shipping refund.

kind: The order adjustment type. Valid values: shipping_refund and refund_discrepancy.

reason: The reason for the order adjustment. To set this value, include discrepancy_reason when you create a refund.

amount_set: The amount of the order adjustment in shop and presentment currencies.

tax_amount_set: The tax amount of the order adjustment in shop and presentment currencies.

processed_at

"processed_at": "2007-01-10T11:00:00-05:00"

The date and time (ISO 8601 format) when the refund was imported. This value can be set to a date in the past when importing from other systems. If no value is provided, then it will be auto-generated as the current time in Shopify.

no_restock: Refunding these items won't affect inventory. The number of fulfillable units for this line item will remain unchanged. For example, a refund payment can be issued but no items will be returned or made available for sale again.

cancel: The items have not yet been fulfilled. The canceled quantity will be added back to the available count. The number of fulfillable units for this line item will decrease.

return: The items were already delivered, and will be returned to the merchant. The returned quantity will be added back to the available count. The number of fulfillable units for this line item will remain unchanged.

legacy_restock: The deprecated restock property was used for this refund. These items were made available for sale again. This value is not accepted when creating new refunds.

location_id: The unique identifier of the location where the items will be restocked. Required when restock_type has the value return or cancel.

subtotal: The subtotal of the refund line item.

total_tax: The total tax on the refund line item.

subtotal_set: The subtotal of the refund line item in shop and presentment currencies.

total_tax_set: The total tax of the line item in shop and presentment currencies.

restock
deprecated

"restock": true

Whether to add the line items back to the store's inventory.

Provide a restock_type to influence how this refund affects inventory instead

Caution

Calculates refund transactions based on line items and shipping. When you want to create a refund,
you should first use the calculate endpoint to generate accurate refund transactions. Specify the line items
that are being refunded, their quantity and restock instructions, and whether you intend to refund
shipping costs. If the restock instructions can't be met—for example, because you try to return more items than have been
fulfilled—then the endpoint returns modified restock instructions. You can then use the response in the body of the request to create the actual refund.

The response includes a transactions object with "kind": "suggested_refund",
which must to be changed to "kind" : "refund" for the refund to be accepted.

shipping

Specify how much shipping to refund. It has the following properties:

full_refund: Whether to refund all remaining shipping.

amount: Set a specific amount to refund for shipping. Takes precedence over full_refund.

refund_line_items

A list of line item IDs, quantities to refund, and restock instructions. Each entry has the following properties:

cancel: The items have not yet been fulfilled. The canceled quantity will be added
back to the available count. The number of fulfillable units for this line item will decrease.

return: The items were already delivered but will be returned to the merchant.
The returned quantity will be added back to the available count.
The number of fulfillable units for this line item will remain unchanged.

location_id: The ID of the location
where the items should be restocked. If location_id is not provided and the value of
restock_type is return or cancel, then the endpoint returns a suitable
location ID.

already_stocked: Whether the item is already stocked at
the location. If this is false, then creating the refund will connect the item to the location and start
stocking it there.

currency

The three-letter code (ISO 4217 format) for the currency used for the refund.

Caution

Creates a refund. Use the calculate endpoint to produce the transactions to submit.

Note

When you use this endpoint with a Partner development store or a trial store, you can create only five refunds per minute.

restock
deprecated

Whether to add the line items back to the store inventory. Use restock_type for refund line items instead.

notify

Whether to send a refund notification to the customer.

note

An optional note attached to a refund.

discrepancy_reason

An optional comment that explains a discrepancy between calculated and actual refund amounts. Used to populate the reason property of the resulting order adjustment object attached to the refund. Valid values: restock, damage, customer, and other.

shipping

Specify how much shipping to refund. It has the following properties:

full_refund: Whether to refund all remaining shipping.

amount: Set a specific amount to refund for shipping. Takes precedence over full_refund.

refund_line_items
required

A list of line item IDs, quantities to refund, and restock instructions. Each entry has the following properties:

cancel: The items have not yet been fulfilled.
The canceled quantity will be added back to the available count.
The number of fulfillable units for this line item will decrease.

return: The items were already delivered but will be returned to the merchant.
The returned quantity will be added back to the available count. The number of fulfillable units for this
line item will remain unchanged.

location_id: The ID of the location where the items should be
restocked. This is required when the value of restock_type is return or cancel.
If the item is not already stocked at the location, then
the item is connected to the location. An error is returned when the item is connected to
a
fulfillment service location and a different location is provided.