# Refund
The Refund resource has two major components:
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 of the calculate
endpoint 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.
## Resource Properties ### Refund * created_at: The date and time (ISO 8601 format) when the refund was created. * Type: x-string * Example: "2008-01-10T11:00:00-05:00" * duties: A list of duties that have been reimbursed as part of the refund. * Type: x-string * Example: {"duties"=>[{"duty_id"=>1, "amount_set"=>{"shop_money"=>{"amount"=>"9.83", "currency_code"=>"CAD"}, "presentment_money"=>{"amount"=>"9.83", "currency_code"=>"CAD"}}}]} * id: The unique identifier for the refund. * Type: x-string * Example: 92738740 * note: An optional note attached to a refund. * Type: x-string * Example: "Item was damaged during shipping" * order_adjustments: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. As of the 2024-10 Admin API version, refunded shipping costs are no longer considered order adjustments and should be accessed through refund_shipping_lines
. Each entry has the following properties:
amount_set
. 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_set
. The taxes that are added to amount
, such as applicable shipping taxes added to a shipping refund.shipping_refund
and refund_discrepancy
.discrepancy_reason
when you create a refund.processed_at
timestamp set to a value earlier the created_at
timestamp. Private apps can't be granted permission by Shopify.
* Type: x-string
* Example: "2007-01-10T11:00:00-05:00"
* refund_duties: A list of refunded duties. Each entry has the following properties:
FULL
: Refunds all the duties associated with a duty ID. You do not need to include refund line items if you are using the full refund type.PROPORTIONAL
: Refunds duties in proportion to the line item quantity that you want to refund. If you choose the proportional refund type, then you must also pass the refund line items to calculate the portion of duties to refund.restock
property was used for this refund. These items were made available for sale again. This value is not accepted when creating new refunds.restock_type
has the value return
or cancel
.A list of refunded shipping lines. Each entry has the following properties:
restock_type
for refund line items instead.
* Type: x-string
* Example: true
* transactions: A list of transactions involved in the refund. A single order can have multiple transactions associated with it. For more information, see the Transaction resource.
* Type: x-string
* Example: [{"id"=>179259969, "order_id"=>450789469, "amount"=>"209.00", "kind"=>"refund", "gateway"=>"shopify_payments", "status"=>"success", "message"=>nil, "created_at"=>"2005-08-05T12:59:12-04:00", "test"=>false, "authorization"=>"authorization-key", "currency"=>"USD", "location_id"=>nil, "user_id"=>nil, "parent_id"=>801038806, "device_id"=>nil, "receipt"=>{}, "error_code"=>nil, "source_name"=>"web"}]
* user_id: The unique identifier of the user who performed the refund.
* Type: x-string
* Example: 238478920
## Retrieves a list of refunds for an order
Retrieves a list of refunds for an order. Note: This endpoint implements pagination by using links that are provided in the response header. To learn more, refer to Make paginated requests to the REST Admin API.
### Endpoint
/admin/api/#{api_version}/orders/{order_id}/refunds.json (GET)
### Parameters
* api_version (required):
* order_id (required):
* fields: Show only certain fields, specified by a comma-separated list of field names.
* in_shop_currency: Show amounts in the shop currency for the underlying transaction.
* limit: The maximum number of results to retrieve.
### Responses
#### 200
Retrieves a list of refunds for an order
Examples:
##### Retrieve all refunds from a specific order
Request:
```
GET /admin/api/unstable/orders/450789469/refunds.json
```
Response:
```
HTTP/1.1 200 OK
{"refunds":[{"id":509562969,"order_id":450789469,"created_at":"2025-01-02T11:38:15-05:00","note":"it broke during shipping","user_id":548380009,"processed_at":"2025-01-02T11:38:15-05:00","duties":[],"total_duties_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"return":null,"restock":true,"additional_fees":[],"total_additional_fees_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"refund_shipping_lines":[],"admin_graphql_api_id":"gid://shopify/Refund/509562969","order_adjustments":[],"refund_line_items":[{"id":104689539,"quantity":1,"line_item_id":703073504,"location_id":487838322,"restock_type":"legacy_restock","subtotal":195.66,"total_tax":3.98,"subtotal_set":{"shop_money":{"amount":"195.66","currency_code":"USD"},"presentment_money":{"amount":"195.66","currency_code":"USD"}},"total_tax_set":{"shop_money":{"amount":"3.98","currency_code":"USD"},"presentment_money":{"amount":"3.98","currency_code":"USD"}},"line_item":{"id":703073504,"variant_id":457924702,"title":"IPod Nano - 8gb","quantity":1,"sku":"IPOD2008BLACK","variant_title":"black","vendor":null,"fulfillment_service":"manual","product_id":632910392,"requires_shipping":true,"taxable":true,"gift_card":false,"name":"IPod Nano - 8gb - black","variant_inventory_management":"shopify","properties":[],"product_exists":true,"fulfillable_quantity":1,"grams":200,"price":"199.00","total_discount":"0.00","fulfillment_status":null,"price_set":{"shop_money":{"amount":"199.00","currency_code":"USD"},"presentment_money":{"amount":"199.00","currency_code":"USD"}},"total_discount_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"discount_allocations":[{"amount":"3.33","discount_application_index":0,"amount_set":{"shop_money":{"amount":"3.33","currency_code":"USD"},"presentment_money":{"amount":"3.33","currency_code":"USD"}}}],"duties":[],"admin_graphql_api_id":"gid://shopify/LineItem/703073504","tax_lines":[{"title":"State Tax","price":"3.98","rate":0.06,"channel_liable":null,"price_set":{"shop_money":{"amount":"3.98","currency_code":"USD"},"presentment_money":{"amount":"3.98","currency_code":"USD"}}}]}},{"id":709875399,"quantity":1,"line_item_id":466157049,"location_id":487838322,"restock_type":"legacy_restock","subtotal":195.67,"total_tax":3.98,"subtotal_set":{"shop_money":{"amount":"195.67","currency_code":"USD"},"presentment_money":{"amount":"195.67","currency_code":"USD"}},"total_tax_set":{"shop_money":{"amount":"3.98","currency_code":"USD"},"presentment_money":{"amount":"3.98","currency_code":"USD"}},"line_item":{"id":466157049,"variant_id":39072856,"title":"IPod Nano - 8gb","quantity":1,"sku":"IPOD2008GREEN","variant_title":"green","vendor":null,"fulfillment_service":"manual","product_id":632910392,"requires_shipping":true,"taxable":true,"gift_card":false,"name":"IPod Nano - 8gb - green","variant_inventory_management":"shopify","properties":[{"name":"Custom Engraving Front","value":"Happy Birthday"},{"name":"Custom Engraving Back","value":"Merry Christmas"}],"product_exists":true,"fulfillable_quantity":1,"grams":200,"price":"199.00","total_discount":"0.00","fulfillment_status":null,"price_set":{"shop_money":{"amount":"199.00","currency_code":"USD"},"presentment_money":{"amount":"199.00","currency_code":"USD"}},"total_discount_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"discount_allocations":[{"amount":"3.34","discount_application_index":0,"amount_set":{"shop_money":{"amount":"3.34","currency_code":"USD"},"presentment_money":{"amount":"3.34","currency_code":"USD"}}}],"duties":[],"admin_graphql_api_id":"gid://shopify/LineItem/466157049","tax_lines":[{"title":"State Tax","price":"3.98","rate":0.06,"channel_liable":null,"price_set":{"shop_money":{"amount":"3.98","currency_code":"USD"},"presentment_money":{"amount":"3.98","currency_code":"USD"}}}]}}],"transactions":[{"id":179259969,"order_id":450789469,"kind":"refund","gateway":"bogus","status":"success","message":null,"created_at":"2005-08-05T12:59:12-04:00","test":false,"authorization":"authorization-key","location_id":null,"user_id":null,"parent_id":801038806,"processed_at":"2005-08-05T12:59:12-04:00","device_id":null,"error_code":null,"source_name":"web","receipt":{},"amount":"209.00","currency":"USD","payment_id":"#1001.3","total_unsettled_set":{"presentment_money":{"amount":"348.0","currency":"USD"},"shop_money":{"amount":"348.0","currency":"USD"}},"manual_payment_gateway":false,"amount_rounding":null,"admin_graphql_api_id":"gid://shopify/OrderTransaction/179259969"}]}]}
```
## Creates a refund
Creates a refund. Use the calculate
endpoint to produce the transactions to submit.
The three-letter code (ISO 4217 format) for the currency used for the refund.
* discrepancy_reason: An optional comment that explains a discrepancy between calculated and actual refund amounts. Used to populate thereason
property of the resulting order_adjustment
object attached to the refund. Valid values: restock
, damage
, customer
, and other
.
* note: An optional note attached to a refund.
* notify: Whether to send a refund notification to the customer.
* refund_line_items: A list of line item IDs, quantities to refund, and restock instructions. Each entry has the following properties:
* restock: Whether to add the line items back to the store inventory. Use restock_type
for refund line items instead.
* shipping: Specify how much shipping to refund. It has the following properties:
* transactions: A list of transactions
to process as refunds. Use the calculate
endpoint to obtain these transactions.
### Responses
#### 201
Creates a refund
Examples:
##### Create a refund for an order
Request:
```
POST /admin/api/unstable/orders/450789469/refunds.json
{"refund":{"currency":"USD","notify":true,"note":"wrong size","shipping":{"full_refund":true},"refund_line_items":[{"line_item_id":518995019,"quantity":1,"restock_type":"return","location_id":487838322}],"transactions":[{"parent_id":801038806,"amount":41.94,"kind":"refund","gateway":"bogus"}]}}
```
Response:
```
HTTP/1.1 201 Created
{"refund":{"id":929361472,"order_id":450789469,"created_at":"2025-01-02T11:38:34-05:00","note":"wrong size","user_id":null,"processed_at":"2025-01-02T11:38:34-05:00","duties":[],"total_duties_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"return":null,"restock":false,"additional_fees":[],"total_additional_fees_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"refund_shipping_lines":[],"admin_graphql_api_id":"gid://shopify/Refund/929361472","order_adjustments":[],"refund_line_items":[{"location_id":null,"restock_type":"no_restock","quantity":1,"id":1058498320,"line_item_id":518995019,"subtotal":0.0,"total_tax":0.0,"subtotal_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"total_tax_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"line_item":{"id":518995019,"variant_id":49148385,"title":"IPod Nano - 8gb","quantity":1,"sku":"IPOD2008RED","variant_title":"red","vendor":null,"fulfillment_service":"manual","product_id":632910392,"requires_shipping":true,"taxable":true,"gift_card":false,"name":"IPod Nano - 8gb - red","variant_inventory_management":"shopify","properties":[],"product_exists":true,"fulfillable_quantity":1,"grams":200,"price":"199.00","total_discount":"0.00","fulfillment_status":null,"price_set":{"shop_money":{"amount":"199.00","currency_code":"USD"},"presentment_money":{"amount":"199.00","currency_code":"USD"}},"total_discount_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"discount_allocations":[{"amount":"3.33","discount_application_index":0,"amount_set":{"shop_money":{"amount":"3.33","currency_code":"USD"},"presentment_money":{"amount":"3.33","currency_code":"USD"}}}],"duties":[],"admin_graphql_api_id":"gid://shopify/LineItem/518995019","tax_lines":[{"title":"State Tax","price":"3.98","rate":0.06,"channel_liable":null,"price_set":{"shop_money":{"amount":"3.98","currency_code":"USD"},"presentment_money":{"amount":"3.98","currency_code":"USD"}}}]}}],"transactions":[{"id":1068278526,"order_id":450789469,"kind":"refund","gateway":"bogus","status":"success","message":"Bogus Gateway: Forced success","created_at":"2025-01-02T11:38:34-05:00","test":true,"authorization":null,"location_id":null,"user_id":null,"parent_id":801038806,"processed_at":"2025-01-02T11:38:34-05:00","device_id":null,"error_code":null,"source_name":"755357713","receipt":{},"amount":"41.94","currency":"USD","payment_id":"c901414060.1","total_unsettled_set":{"presentment_money":{"amount":"348.0","currency":"USD"},"shop_money":{"amount":"348.0","currency":"USD"}},"manual_payment_gateway":false,"amount_rounding":null,"admin_graphql_api_id":"gid://shopify/OrderTransaction/1068278526"}]}}
```
##### Refund a specific amount of shipping
Request:
```
POST /admin/api/unstable/orders/450789469/refunds.json
{"refund":{"currency":"USD","shipping":{"amount":5.0},"transactions":[{"parent_id":801038806,"amount":5.0,"kind":"refund","gateway":"web"}]}}
```
Response:
```
HTTP/1.1 201 Created
{"refund":{"id":929361471,"order_id":450789469,"created_at":"2025-01-02T11:38:32-05:00","note":null,"user_id":null,"processed_at":"2025-01-02T11:38:32-05:00","duties":[],"total_duties_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"return":null,"restock":false,"additional_fees":[],"total_additional_fees_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"refund_shipping_lines":[{"id":623176826,"shipping_line_id":369256396,"subtotal_amount_set":{"shop_money":{"amount":"5.00","currency_code":"USD"},"presentment_money":{"amount":"5.00","currency_code":"USD"}},"shipping_line":{"id":369256396,"carrier_identifier":null,"code":"Free Shipping","discounted_price":"5.00","discounted_price_set":{"shop_money":{"amount":"5.00","currency_code":"USD"},"presentment_money":{"amount":"5.00","currency_code":"USD"}},"phone":null,"price":"5.00","price_set":{"shop_money":{"amount":"5.00","currency_code":"USD"},"presentment_money":{"amount":"5.00","currency_code":"USD"}},"requested_fulfillment_service_id":null,"source":"shopify","title":"Free Shipping","tax_lines":[],"discount_allocations":[]}}],"admin_graphql_api_id":"gid://shopify/Refund/929361471","order_adjustments":[{"id":1030976844,"order_id":450789469,"refund_id":929361471,"amount":"-5.00","tax_amount":"0.00","kind":"shipping_refund","reason":"Shipping refund","amount_set":{"shop_money":{"amount":"-5.00","currency_code":"USD"},"presentment_money":{"amount":"-5.00","currency_code":"USD"}},"tax_amount_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}}}],"refund_line_items":[],"transactions":[{"id":1068278525,"order_id":450789469,"kind":"refund","gateway":"bogus","status":"success","message":"Bogus Gateway: Forced success","created_at":"2025-01-02T11:38:32-05:00","test":true,"authorization":null,"location_id":null,"user_id":null,"parent_id":801038806,"processed_at":"2025-01-02T11:38:32-05:00","device_id":null,"error_code":null,"source_name":"755357713","receipt":{},"amount":"5.00","currency":"USD","payment_id":"c901414060.1","total_unsettled_set":{"presentment_money":{"amount":"348.0","currency":"USD"},"shop_money":{"amount":"348.0","currency":"USD"}},"manual_payment_gateway":false,"amount_rounding":null,"admin_graphql_api_id":"gid://shopify/OrderTransaction/1068278525"}]}}
```
## Retrieves a specific refund
Retrieves a specific refund.
### Endpoint
/admin/api/#{api_version}/orders/{order_id}/refunds/{refund_id}.json (GET)
### Parameters
* api_version (required):
* order_id (required):
* refund_id (required):
* fields: Show only certain fields, specified by a comma-separated list of field names.
* in_shop_currency: Show amounts in the shop currency for the underlying transaction.
### Responses
#### 200
Retrieves a specific refund
Examples:
##### Retrieve a specific refund
Request:
```
GET /admin/api/unstable/orders/450789469/refunds/509562969.json
```
Response:
```
HTTP/1.1 200 OK
{"refund":{"id":509562969,"order_id":450789469,"created_at":"2025-01-02T11:38:15-05:00","note":"it broke during shipping","user_id":548380009,"processed_at":"2025-01-02T11:38:15-05:00","duties":[],"total_duties_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"return":null,"restock":true,"additional_fees":[],"total_additional_fees_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"refund_shipping_lines":[],"admin_graphql_api_id":"gid://shopify/Refund/509562969","order_adjustments":[],"refund_line_items":[{"id":104689539,"quantity":1,"line_item_id":703073504,"location_id":487838322,"restock_type":"legacy_restock","subtotal":195.66,"total_tax":3.98,"subtotal_set":{"shop_money":{"amount":"195.66","currency_code":"USD"},"presentment_money":{"amount":"195.66","currency_code":"USD"}},"total_tax_set":{"shop_money":{"amount":"3.98","currency_code":"USD"},"presentment_money":{"amount":"3.98","currency_code":"USD"}},"line_item":{"id":703073504,"variant_id":457924702,"title":"IPod Nano - 8gb","quantity":1,"sku":"IPOD2008BLACK","variant_title":"black","vendor":null,"fulfillment_service":"manual","product_id":632910392,"requires_shipping":true,"taxable":true,"gift_card":false,"name":"IPod Nano - 8gb - black","variant_inventory_management":"shopify","properties":[],"product_exists":true,"fulfillable_quantity":1,"grams":200,"price":"199.00","total_discount":"0.00","fulfillment_status":null,"price_set":{"shop_money":{"amount":"199.00","currency_code":"USD"},"presentment_money":{"amount":"199.00","currency_code":"USD"}},"total_discount_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"discount_allocations":[{"amount":"3.33","discount_application_index":0,"amount_set":{"shop_money":{"amount":"3.33","currency_code":"USD"},"presentment_money":{"amount":"3.33","currency_code":"USD"}}}],"duties":[],"admin_graphql_api_id":"gid://shopify/LineItem/703073504","tax_lines":[{"title":"State Tax","price":"3.98","rate":0.06,"channel_liable":null,"price_set":{"shop_money":{"amount":"3.98","currency_code":"USD"},"presentment_money":{"amount":"3.98","currency_code":"USD"}}}]}},{"id":709875399,"quantity":1,"line_item_id":466157049,"location_id":487838322,"restock_type":"legacy_restock","subtotal":195.67,"total_tax":3.98,"subtotal_set":{"shop_money":{"amount":"195.67","currency_code":"USD"},"presentment_money":{"amount":"195.67","currency_code":"USD"}},"total_tax_set":{"shop_money":{"amount":"3.98","currency_code":"USD"},"presentment_money":{"amount":"3.98","currency_code":"USD"}},"line_item":{"id":466157049,"variant_id":39072856,"title":"IPod Nano - 8gb","quantity":1,"sku":"IPOD2008GREEN","variant_title":"green","vendor":null,"fulfillment_service":"manual","product_id":632910392,"requires_shipping":true,"taxable":true,"gift_card":false,"name":"IPod Nano - 8gb - green","variant_inventory_management":"shopify","properties":[{"name":"Custom Engraving Front","value":"Happy Birthday"},{"name":"Custom Engraving Back","value":"Merry Christmas"}],"product_exists":true,"fulfillable_quantity":1,"grams":200,"price":"199.00","total_discount":"0.00","fulfillment_status":null,"price_set":{"shop_money":{"amount":"199.00","currency_code":"USD"},"presentment_money":{"amount":"199.00","currency_code":"USD"}},"total_discount_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"discount_allocations":[{"amount":"3.34","discount_application_index":0,"amount_set":{"shop_money":{"amount":"3.34","currency_code":"USD"},"presentment_money":{"amount":"3.34","currency_code":"USD"}}}],"duties":[],"admin_graphql_api_id":"gid://shopify/LineItem/466157049","tax_lines":[{"title":"State Tax","price":"3.98","rate":0.06,"channel_liable":null,"price_set":{"shop_money":{"amount":"3.98","currency_code":"USD"},"presentment_money":{"amount":"3.98","currency_code":"USD"}}}]}}],"transactions":[{"id":179259969,"order_id":450789469,"kind":"refund","gateway":"bogus","status":"success","message":null,"created_at":"2005-08-05T12:59:12-04:00","test":false,"authorization":"authorization-key","location_id":null,"user_id":null,"parent_id":801038806,"processed_at":"2005-08-05T12:59:12-04:00","device_id":null,"error_code":null,"source_name":"web","receipt":{},"amount":"209.00","currency":"USD","payment_id":"#1001.3","total_unsettled_set":{"presentment_money":{"amount":"348.0","currency":"USD"},"shop_money":{"amount":"348.0","currency":"USD"}},"manual_payment_gateway":false,"amount_rounding":null,"admin_graphql_api_id":"gid://shopify/OrderTransaction/179259969"}]}}
```
## Calculates a refund
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.
### Endpoint
/admin/api/#{api_version}/orders/{order_id}/refunds/calculate.json (POST)
### Parameters
* api_version (required):
* order_id (required):
* currency:
The three-letter code (ISO 4217 format) for the
currency used for the refund. Note: Required whenever the shipping amount
property is provided.