# Refund <p>The Refund resource has two major components:</p> <ul> <li>Transaction records of money returned to the customer</li> <li>The line items included in the refund, along with restocking instructions</li> </ul> <p>Before you create a refund, use the <code>calculate</code> 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 <code>calculate</code> endpoint to create the actual refund.</p> <p>When you create a refund using the response from the <code>calculate</code> 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 <code>amount</code> property.</p> <p>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.</p> ## Resource Properties ### Refund * created_at: The date and time (<a href='https://en.wikipedia.org/wiki/ISO_8601'target="_blank">ISO 8601</a> 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: <p>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 <code>refund_shipping_lines</code>. Each entry has the following properties:</p> <ul> <li><strong>id</strong>: The unique identifier for the order adjustment.</li> <li><strong>order_id</strong>: The unique identifier for the order that the order adjustment is associated with.</li> <li><strong>refund_id</strong>: The unique identifier for the refund that the order adjustment is associated with.</li> <li><strong>amount</strong>: This field is deprecated, please use <code>amount_set</code>. The value of the discrepancy between the calculated refund and the actual refund. If the <code>kind</code> property's value is <code>shipping_refund</code>, then <code>amount</code> returns the value of shipping charges refunded to the customer.</li> <li><strong>tax_amount</strong>: This field is deprecated, please use <code>tax_amount_set</code>. The taxes that are added to <code>amount</code>, such as applicable shipping taxes added to a shipping refund.</li> <li><strong>kind</strong>: This field is deprecated as of the 2024-10 Admin API and will not be supported in the future. The order adjustment type. Valid values: <code>shipping_refund</code> and <code>refund_discrepancy</code>.</li> <li><strong>reason</strong>: The reason for the order adjustment. To set this value, include <code>discrepancy_reason</code> when you create a refund.</li> <li><strong>amount_set</strong>: The amount of the order adjustment in shop and presentment currencies.</li> <li><strong>tax_amount_set</strong>: The tax amount of the order adjustment in shop and presentment currencies.</li> </ul> * Type: x-string * Example: [{"id"=>4221763620, "order_id"=>171016912932, "refund_id"=>8244756516, "amount"=>"10.00", "tax_amount"=>"0.00", "kind"=>"refund_discrepancy", "reason"=>"Refund discrepancy", "amount_set"=>{"shop_money"=>{"amount"=>10.0, "currency_code"=>"CAD"}, "presentment_money"=>{"amount"=>7.3, "currency_code"=>"USD"}}, "tax_amount_set"=>{"shop_money"=>{"amount"=>0.0, "currency_code"=>"CAD"}, "presentment_money"=>{"amount"=>0.0, "currency_code"=>"USD"}}}] * processed_at: The date and time (<a href='https://en.wikipedia.org/wiki/ISO_8601' target="_blank">ISO 8601</a> 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. Public apps need to be granted permission by Shopify to import orders with the <code>processed_at</code> timestamp set to a value earlier the <code>created_at</code> timestamp. Private apps can't be granted permission by Shopify. * Type: x-string * Example: "2007-01-10T11:00:00-05:00" * refund_duties: <p>A list of refunded duties. Each entry has the following properties:</p> <ul> <li><strong>duty_id</strong>: The unique identifier of the duty.</li> <li><strong>refund_type</strong>: Specifies how you want the duty refunded. Valid values:</li> <ul> <li><code>FULL</code>: 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.</li> <li><code>PROPORTIONAL</code>: 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.</li> </ul> </ul> * Type: x-string * Example: [{"duty_id"=>1, "refund_type"=>"FULL"}] * refund_line_items: A list of refunded line items. Each entry has the following properties: <ul> <li><strong>id</strong>: The unique identifier of the line item in the refund.</li> <li><strong>line_item</strong>: A line item being refunded.</li> <li><strong>line_item_id</strong>: The ID of the related line item in the order.</li> <li><strong>quantity</strong>: The refunded quantity of the associated line item.</li> <li><strong>restock_type</strong>: How this refund line item affects inventory levels. Valid values: <ul> <li><strong>no_restock</strong>: 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 refunded or made available for sale again.</li> <li><strong>cancel</strong>: 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.</li> <li><strong>return</strong>: The items were already delivered, and will be returned to the merchant. The refunded quantity will be added back to the available count. The number of fulfillable units for this line item will remain unchanged.</li> <li><strong>legacy_restock</strong>: The deprecated <code>restock</code> property was used for this refund. These items were made available for sale again. This value is not accepted when creating new refunds.</li> </ul> </li> <li><strong>location_id</strong>: The unique identifier of the <a href="/api/admin-rest/current/resources/location">location</a> where the items will be restocked. Required when <code>restock_type</code> has the value <code>return</code> or <code>cancel</code>.</li> <li><strong>subtotal</strong>: The subtotal of the refund line item.</li> <li><strong>total_tax</strong>: The total tax on the refund line item.</li> <li><strong>subtotal_set</strong>: The subtotal of the refund line item in shop and presentment currencies.</li> <li><strong>total_tax_set</strong>: The total tax of the line item in shop and presentment currencies.</li> </ul> * Type: x-string * Example: [{"id"=>209341123, "line_item"=>{}, "line_item_id"=>128323456, "quantity"=>2, "location_id"=>40642626, "restock_type"=>"return", "subtotal"=>10.99, "total_tax"=>2.67, "subtotal_set"=>{"shop_money"=>{"amount"=>10.99, "currency_code"=>"CAD"}, "presentment_money"=>{"amount"=>8.95, "currency_code"=>"USD"}}, "total_tax_set"=>{"shop_money"=>{"amount"=>1.67, "currency_code"=>"CAD"}, "presentment_money"=>{"amount"=>1.32, "currency_code"=>"USD"}}}] * refund_shipping_lines: <p>A list of refunded shipping lines. Each entry has the following properties:</p> <ul> <li><strong>id</strong>: The unique identifier of the shipping line in the refund.</li> <li><strong>shipping_line</strong>: The shipping line being refunded.</li> <li><strong>shipping_line_id</strong>: The ID of the related shipping line in the order.</li> <li><strong>subtotal_amount_set</strong>: The subtotal of the refund shipping line in shop and presentment currencies.</li> </ul> * Type: x-string * Example: [{"id"=>712736824, "shipping_line"=>{}, "shipping_line_id"=>8845532987448, "subtotal_amount_set"=>{"shop_money"=>{"amount"=>5.0, "currency_code"=>"CAD"}, "presentment_money"=>{"amount"=>3.65, "currency_code"=>"USD"}}}] * restock: Whether to add any of the line items back to the store's inventory. Use <code>restock_type</code> 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 <a href="/api/admin-rest/current/resources/transaction"> Transaction</a> 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. <strong>Note:</strong> This endpoint implements pagination by using links that are provided in the response header. To learn more, refer to <a href='/api/usage/pagination-rest'>Make paginated requests to the REST Admin API</a>. ### 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 <aside class="note caution"> <h4>Caution</h4> <p>For multi-currency orders, the <code>currency</code> property is required whenever the <code>amount</code> property is provided. </p> </aside> <p>Creates a refund. Use the <code>calculate</code> endpoint to produce the transactions to submit.</p> <br/> <aside class="note"> <h4>Note</h4> <p>When you use this endpoint with a Partner development store or a trial store, you can create only five refunds per minute.</p> </aside> ### Endpoint /admin/api/#{api_version}/orders/{order_id}/refunds.json (POST) ### Parameters * api_version (required): * order_id (required): * currency: <p>The three-letter code (<a href="https://en.wikipedia.org/wiki/ISO_4217" target="_blank">ISO 4217</a> format) for the currency used for the refund.</p> * discrepancy_reason: An optional comment that explains a discrepancy between calculated and actual refund amounts. Used to populate the <code>reason</code> property of the resulting <code>order_adjustment</code> object attached to the refund. Valid values: <code>restock</code>, <code>damage</code>, <code>customer</code>, and <code>other</code>. * 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 <code>restock_type</code> for refund line items instead. * shipping: Specify how much shipping to refund. It has the following properties: * transactions: A list of <a href="/api/admin-rest/current/resources/transaction">transactions</a> to process as refunds. Use the <code>calculate</code> 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 <aside class="note caution"> <h4>Caution</h4> <p>For multi-currency orders, the <code>currency</code> property is required whenever the <code>amount</code> property is provided.</p> </aside> <p>Calculates refund transactions based on line items and shipping. When you want to create a refund, you should first use the <code>calculate</code> 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.</p> <p>The response includes a <code>transactions</code> object with <code>"kind": "suggested_refund"</code>, which must to be changed to <code>"kind" : "refund"</code> 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: <p>The three-letter code (<a href="https://en.wikipedia.org/wiki/ISO_4217" target="_blank">ISO 4217</a> format) for the currency used for the refund. <strong>Note:</strong> Required whenever the shipping <code>amount</code> property is provided.</p> * refund_line_items: A list of line item IDs, quantities to refund, and restock instructions. Each entry has the following properties: * shipping: Specify how much shipping to refund. It has the following properties: ### Responses #### 200 Calculates a refund Examples: ##### Calculate a refund for a partial amount of shipping Request: ``` POST /admin/api/unstable/orders/450789469/refunds/calculate.json {"refund":{"currency":"USD","shipping":{"amount":2.0}}} ``` Response: ``` HTTP/1.1 200 OK {"refund":{"duties":[],"total_duties_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"return":null,"shipping":{"amount":"2.00","tax":"0.00","maximum_refundable":"5.00"},"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":null,"shipping_line_id":369256396,"subtotal_amount_set":{"shop_money":{"amount":"2.00","currency_code":"USD"},"presentment_money":{"amount":"2.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":[]}}],"refund_line_items":[],"transactions":[{"order_id":450789469,"kind":"suggested_refund","gateway":"bogus","parent_id":801038806,"amount":"2.00","currency":"USD","maximum_refundable":"41.94"}],"currency":"USD"}} ``` ##### Calculate the refund for a line item and shipping Request: ``` POST /admin/api/unstable/orders/450789469/refunds/calculate.json {"refund":{"currency":"USD","shipping":{"full_refund":true},"refund_line_items":[{"line_item_id":518995019,"quantity":1,"restock_type":"no_restock"}]}} ``` Response: ``` HTTP/1.1 200 OK {"refund":{"duties":[],"total_duties_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"return":null,"shipping":{"amount":"0.00","tax":"0.00","maximum_refundable":"0.00"},"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":[],"refund_line_items":[{"quantity":1,"line_item_id":518995019,"location_id":null,"restock_type":"no_restock","price":"199.00","subtotal":"195.67","total_tax":"3.98","discounted_price":"199.00","discounted_total_price":"199.00","total_cart_discount_amount":"3.33"}],"transactions":[{"order_id":450789469,"kind":"suggested_refund","gateway":"bogus","parent_id":801038806,"amount":"41.94","currency":"USD","maximum_refundable":"41.94"}],"currency":"USD"}} ``` ##### Calculate the refund without specifying currency Request: ``` POST /admin/api/unstable/orders/450789469/refunds/calculate.json {"refund":{"shipping":{"full_refund":true},"refund_line_items":[{"line_item_id":518995019,"quantity":1,"restock_type":"no_restock"}]}} ``` Response: ``` HTTP/1.1 200 OK {"refund":{"duties":[],"total_duties_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"return":null,"shipping":{"amount":"0.00","tax":"0.00","maximum_refundable":"0.00"},"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":[],"refund_line_items":[{"quantity":1,"line_item_id":518995019,"location_id":null,"restock_type":"no_restock","price":"199.00","subtotal":"195.67","total_tax":"3.98","discounted_price":"199.00","discounted_total_price":"199.00","total_cart_discount_amount":"3.33"}],"transactions":[{"order_id":450789469,"kind":"suggested_refund","gateway":"bogus","parent_id":801038806,"amount":"41.94","currency":"USD","maximum_refundable":"41.94"}],"currency":"USD"}} ```