Problem cancelling and refunding a simple order

Pedro_Domingues
New Member
9 0 0

Dear Shopify,

 

I have cancelled the order 680277803097 using the REST API.

However despite my indications for refunding, Shopify did not refund this order (I had to do it manually through the interface). However, Shopify did cancel the order.

 

This was the JSON payload I sent to the API:

 

{

  "email": true,

  "refund": {

    "shipping": {

      "full_refund": true

    },

    "refund_line_items": [

      {

        "line_item_id": "1584110665817",

        "quantity": 1,

        "restock_type": "no_restock"

      }

    ],

    "restock": false

  }

}

 

 

This was sent to /orders/680277803097/cancel.json

 

What did I miss here? Why didn't Shopify refunded the customer automatically?

 

Thanks!

0 Likes
KarlOffenberger
Shopify Partner
1867 182 777

Hi Pedro,

You are missing the transactions property in the refund.

{
  "email": true,
	"refund": {
		"currency": "CZK",
		"shipping": {
			"full_refund": true
		},
		"refund_line_items": [
			{
				"line_item_id": 1986159542387,
				"quantity": 1
			}
		],
		"transactions": [
			{
				"parent_id": 902690340979,
				"amount": 380.00,
				"kind": "refund",
				"gateway": "bogus"
			}
		]
	}
}

Where parent_id is the transaction ID of an order, i.e. an authorization transaction. Can query those by following this doc.

Hope that helps.

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
Pedro_Domingues
New Member
9 0 0

Thank you for helping, I'm gonna try this solution.

0 Likes
Pedro_Domingues
New Member
9 0 0

I am trying to cancel and refund an order using this endpoint:

 

https://help.shopify.com/en/api/reference/orders/order#cancel

 

With the following payload:

 

{"refund": {
    "shipping": {"full_refund": true},
    "refund_line_items": [{
        "quantity": 1,
        "line_item_id": 2032498606169,
        "price": "39.90",
        "subtotal": "39.90",
        "total_tax": "6.37",
        "discounted_total_price": "39.90",
        "total_cart_discount_amount": "0.00",
        "location_id": null,
        "restock_type": "no_restock",
        "discounted_price": "39.90"
    }],
    "transactions": [{
        "amount": "39.90",
        "maximum_refundable": "39.90",
        "kind": "refund",
        "parent_id": 1147873263705,
        "currency": "EUR",
        "order_id": 922997620825,
        "gateway": "amazon_payments"
    }],
    "notify": true
}}

 

The order has just this one article, so I am basically refunding the entirety of this order.

 

However, this REST API call returns success, but when I go check the order's page, I do see indeed that the order was cancelled, but there was no refund after all.

 

firefox_jeb6DRYRLx.png

 

And the order status displays "Canceled", "Paid", "Unfulfilled". So I end up having to refund it manually.


Why is my REST call just cancelling this order, but not proceeding with the refunding?


Thanks!

0 Likes
kristo_ox
New Member
4 0 0

Hi Pedro... 

Did you found a solution to this? 

0 Likes
Lenathompson23
New Member
2 0 0

Someone needs to help me. I ordered something through a shopify store last night i’m tried to cancel it immediately. the store is simple luxurys. I want to cancel this order and get an immediate refund. There were reviews of the product burning peoples eyes. I am going to sue if no one helps me. And you can’t contact anyone if you don’t have a shopify store. The system is very dumb. 

0 Likes