Error calculate full shipping refund via REST API

Request:

Calculate refund

{
  refund: {
    shipping: {
      full_refund: true
    }
  }
}

Response:

{"errors":{"refund_shipping_lines":["is invalid"]},"error_reference":"If you report this error, please include this id: 674bf623-9044-4efc-b7eb-6074d122acd7-1721085465."}

We’ve been doing shipping refunds like these without issue. This appears to be a new error. Based on the API documentation, there is no refund_shipping_lines field in this API endpoint. It is unclear what the issue is.

Hi Steven,

From checking the ID on our side, I’m not seeing a lot of info other than the call to /refunds/calculate.json failed - the reference to refund_shipping_lines implies that you tried to use refund_shipping_lines in the request, but it doesn’t seem like you did. If you try the same request with the 2023-10 version instead, do you see the same error?

Alternatively could you try testing if you can query an orders SuggestedRefund object to return a suggested refund amount based on the items being reimbursed. It could look something like:

query CalculateSuggestedRefund {
  order(id: "gid://shopify/Order/1234567890") {
    suggestedRefund(
      refundLineItems: [
        {
          lineItemId: "gid://shopify/LineItem/0987654321",
          quantity: 1
        }
      ],
      refundShipping: true,
      shippingAmount: {
        amount: "5.00",
        currencyCode: USD
      }
    ) {
      totalRefundedSet {
        presentmentMoney {
          amount
          currencyCode
        }
      }
    }
  }
}

And you can test this out with the GraphiQL tool.

Hi Liam,

I was able to get the original request to work by first unarchiving/opening the order.

This seems like a new bug/requirement as we’ve done thousands of successful refund calculation requests like these before and I’m sure at least some of those involved orders that were archived.

Maybe this additional piece of information helps?

Thanks for looking into this!

Hi,

Did you try this one for calculate the refund:

POST “https://***.myshopify.com/admin/api/2024-01/orders/6215336/refunds/calculate.json”

{“refund”:{“currency”:“EUR”,“shipping”:{“amount”:4.95},“refund_line_items”:[{“line_item_id”:“15********”,“quantity”:“1”}]}}

for me its always works fine.

Thanks. However, that is a different request entirely as it specifies a shipping amount as well as refund_line_items.