How to refund order with multiple transactions via REST api?

How to refund order with multiple transactions via REST api?

Matthias7
Excursionist
30 3 3

Here is an example JSON needed to refund an order with multiple transactions since the shopify documenation does not provide one. 

I wasted a lot of time with this, so hopefully this helps someone avoid that :))

 

 

{
    "refund": {
        "notify": "true",
        "note": "",
        "shipping": {
            "full_refund": "false"
        },
        "refund_line_items": [
            {
                "price": 191.94,
                "line_item_id": xxx,
                "quantity": 1,
                "restock_type": "no_restock",
                "location_id": xxx
            },
            {
                "price": 155.94,
                "line_item_id": xxx,
                "quantity": 1,
                "restock_type": "no_restock",
                "location_id": xxx
            },
            {
                "price": 21,
                "line_item_id": xxx,
                "quantity": 1,
                "restock_type": "no_restock",
                "location_id": xxx
            }
        ],
        "transactions": [
            {
                "parent_id": xxx,
                "currency": "EUR",
                "amount": "347.88",
                "kind": "refund",
                "gateway": "bogus"
            },
            {
                "parent_id": xxx,
                "currency": "EUR",
                "amount": "21.00",
                "kind": "refund",
                "gateway": "bogus"
            }
        ]
    }
}

 

Reply 1 (1)

Matthias7
Excursionist
30 3 3

As you can see, the refund_line_items need to all be individual objects in one array, otherwise you get the: 

array expected to be hash

error 

 

The multiple transactions need to also be individual objects in one array 

 

Cheers,

Matthias7