Expected string to be id

Topic summary

A developer encountered an “Expected string to be id” error when attempting to calculate refunds using the Shopify Admin API endpoint admin/api/2021-04/orders/{{ORDER_ID}}/refunds/calculate.json via the JS SDK.

Issue identified:

  • The POST request body structure was incorrect
  • Currency was set to “INR” in the original attempt

Solution provided:

  • Include shipping price in the refund calculation
  • Follow proper data structure: {"refund":{"currency":"USD","shipping":{"amount":2.0}}}
  • Remove the "responseType": "json" key-value pair from the request

Resolution:
After implementing these corrections, the refund calculation process worked successfully. The issue was resolved by fixing the request body format and removing the unnecessary responseType parameter.

Summarized with AI on November 10. AI used: claude-sonnet-4-5-20250929.

Hello,

i’m trying to ..

admin/api/2021-04/orders/{{ORDER_ID}}/refunds/calculate.json by JS SDK method

The currency has “INR” value
But it returns the error message expected String to be a Id

Hi,

if i am not wrong then your POST body is not right.

please change it:

you must have to provide the shipping price inside so that shopify endpoint can calculate the refunds with shipping price.

please follow this Data structure:

{“refund”:{“currency”:“USD”,“shipping”:{“amount”:2.0}}}

i hope this will solve your issue.

Thanks

Hello Muhammadsalmank,

Thank you for you time. The problem was with the ‘responseType: “json”’ key-value pair. After removing it, the process worked successfully.