Make a Partial Refund with Shopify API

Highlighted
Shopify Partner
1 0 0

Per the documentation, I see how I can fully refund an entire order, + or - Shipping, but How do I refund only a certain amount on the order such as $23.00 on a $50.00 order (if the customer requests to cancel an order, we charge a restocking fee.)

 

https://help.shopify.com/en/api/reference/orders/refund#what-you-can-do-with-refund

0 Likes
Highlighted
Shopify Partner
1840 177 711

You would need to use the refunds endpoint as you already pointed out in your question and the link you provide. Prior to making the request, you would need to know the order ID, the line item ID (or items) being returned (you get that info from the order itself) and the parent transaction ID you shall reference as the payment being refunded (you get that from /orders/<ORDER_ID>/transactions.json) as well as the location ID where you shall be re-stocking the returned merchandise.

 

Once you have those, POST /admin/orders/<ORDER_ID>/refunds.json

 

{
  "refund": {
    "currency": "USD",
    "notify": true,
    "note": "wrong size",
    "shipping": {
      "full_refund": false
    },
    "refund_line_items": [
      {
        "line_item_id": 2266028769395,
        "quantity": 1,
        "restock_type": "return",
        "location_id": 7245332595
      }
    ],
    "transactions": [
      {
        "parent_id": 1092479058035,
        "amount": 23,
        "kind": "refund",
        "gateway": "Cash on Delivery (COD)"
      }
    ]
  }
}

In above example we send a refund notification, set a return reason in the note and do not refund the shipping costs. The gateway would depend on your transaction - I used COD as an example here.

 

That's it really - let me know if anything isn't clear or you have additional questions.

 

Best wishes!

Liked this post? You might also like our fantastic upsell apps Candy Rack and Candy Cart or offer free gifts with Gift Box. All made with ❤️  and care by Digismoothie
0 Likes
Highlighted
Excursionist
16 2 2

@KarlOffenberger  Do you have to specifiy a line item? I want to just refund a customer an amount not based on a line item. I.e. just refund them $5.00 like you're able to do when you click on the order in Shopify's admin portal:

shopify refund example.png

0 Likes