Calculate Refund - Required parameter missing or invalid

Mat192
Shopify Partner
3 0 2

I'm  trying to use the refund/calculate api via POST to : 

 

 

{{BaseUrl}}/admin/api/2022-04/orders/4876950962428/refunds/calculate.json

 

 

 

My body is :

 

 

{"refund":
    {
        "shipping": {"full_refund": true},
        "refund_line_items": [
            {"line_item_id": 12397092864252, "quantity": 1, "restock_type": "return"}
        ]
    }
}

 

 

The error I get is 

 

{
    "errors": {
        "refund": "Required parameter missing or invalid"
    }
}

 

 

I have confirmed the order_id and refund_line_id by retrieving the order previously, and cutting and pasting the values across. 

 

I have tried using location_id, different restock_types, currencies, all with the same result.

 

The structure of my data is the same to previous solutions of this problem.

 

I'm making my call via PostMan

 

I'm totally stumped - grateful for any help.

Reply 1 (1)

JamesG
Shopify Staff
42 10 10

Hi @Mat192 ,

Are you sure you're including the "Content-Type:application/json" header, as well as formatting the Body as Raw/JSON in the Postman client? 

We can't provide authenticated support in the forums, but if you've got a valid order and line item id, could you try double checking your formatting in a cURL request using Postman's code generating feature, and sharing that code (without the 
X-Shopify-Access-Token) as well as the X-Request-ID header from the response so I can take a look at our logs?

 

Cheers,

JamesG | API Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog