Calculated refund returns "Unprocessable Entity" when doing a partial shipping refund

Topic summary

Issue: Calculating a refund via Shopify Admin REST (2024-01) refunds calculate endpoint from a Remix app fails when attempting a partial shipping refund.

  • What works: Using shipping: {“full_refund”: true} returns a successful calculation.
  • What fails: Using shipping: {“amount”: 29} returns HTTP 422 (Unprocessable Entity).

Details:

  • Endpoint: POST /admin/api/2024-01/orders/{order_id}/refunds/calculate (per linked docs).
  • Error 422 generally indicates the request was understood but contains semantic/validation issues.

User stance: Suspects a potential API bug given the simplicity of the request, but is unsure and requests help.

Artifacts: Screenshots included (likely showing request payload and the 422 response); they are central to understanding the exact inputs/outputs.

Status: No resolution or workaround provided yet; discussion is open with the key question of why partial shipping refunds via the calculate endpoint are rejected while full refunds succeed.

Summarized with AI on January 1. AI used: gpt-5.

I’m trying to calculate a refund via this REST endpoint in a Remix application.

When I calculate a refund with a full shipping refund - “shipping”: {“full_refund”: true} - everything works fine.

However, when I’m trying to do a partial shipping refund - “shipping”: {“amount”: 29} - it doesn’t work.

Instead, I get an HTTPError: Response code 422 (Unprocessable Entity).

It’s not the most difficult endpoint in the world, so I suspect a bug. But hard to tell.

Help? :sweat_smile: