Refund 400

Solved
Highlighted
Tourist
5 1 0

Hi, im doing a warehouse integration to shopify and have all parts completed except refund. When I try to do a refund, either when I return lines or just try to return freight I get a 400.

 

[POST]

url {company}.myshopify.com/admin/api/2020-04/orders/{orderid}/refunds/calculate.json returns 400 bad request with a body of 

{
  "refund": {
    "currency": "SEK",
    "shipping": {
      "amount": 2.0
    }
  }
}
 
and a body of
{
"refund":
{
"refund_line_items":[
{"line_item_id":5564114108565,"quantity":2,"location_id":47415558293,"restock_type":"cancel"}
],
"currency":"SEK",
"shipping": {
"full_refund": true
}
}
}
 
same with trying to do a refund without calcultions with a transaction returns 400 bad request. 
 
The get method for get refund works, but the rest I get 400 for.
 
[GET]
{company}.myshopify.com/admin/api/2020-04/orders/{orderId}refunds.json.
 
As I've correctly communicated in other api functions, verified that the item_id, location_id and order_id exists Im at a loss.
 
Will be grateful for any ideas.
 
Best

Jonathan

 

 

0 Likes
Highlighted
Tourist
5 1 0

Can also add I have all requirements on my api-key. see attached.apirequirements.png

0 Likes
Highlighted
Shopify Staff
Shopify Staff
461 93 77

Hey @JonathanBex 

Apps are required to specify a restock_type and a location_id on the refund_line_item. Check out the example in the docs here and give that a go: https://shopify.dev/docs/admin-api/rest/reference/orders/refund?api[version]=2020-04#create-2020-04

Vix | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 


0 Likes
Highlighted
Tourist
5 1 0

Hi, thank you for your answer however I dont think that is where the problem lies, since if you look at my example I have both location_id and restock_type specified on the line_item. I am also trying to just a single shipping_refund which also grants me a 400. 

 

Best

//J

0 Likes
Highlighted
Tourist
5 1 0

Hi, any other ideas? I've tried both [POST] /admin/api/2020-04/orders/{order_id}/refunds/calculate.json and [POST] /admin/api/2020-04/orders/{order_id}/refunds.json

 

with a shipping refund which does not need location_id or item_id 

{
  "refund": {
    "currency": "SEK",
    "shipping": {
      "amount": 2.0
    }
  }
}
 
And a refund which has both.
 
{
"refund":
{
"refund_line_items":[
{"line_item_id":5564114108565,"quantity":2,"location_id":47415558293,"restock_type":"cancel"}
],
"currency":"SEK",
"shipping": {
"full_refund": true
}
}
}
 
Both these models gives me a 400 request. 
 
Im using api 2020-04.
 
 
Im a loss, since the get refunds works
[GET]
{company}.myshopify.com/admin/api/2020-04/orders/{orderId}refunds.json. 
 
but not any of the calc or refund.
 
Best
 
//J
0 Likes
Highlighted
Tourist
5 1 0

This is an accepted solution.

Hi, we can close this. Your latest update seemingly made this work with no code change from mine so Im guessing it was a problem on your end. My refund works now. Thank you

 

Best

Jonathan

0 Likes