Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: How can I calculate the correct refund amount for a line item including taxes?

How can I calculate the correct refund amount for a line item including taxes?

PurpleMamba
Shopify Partner
126 1 18

I'm trying to create a refund via GraphQL API for specific line items in an order.

 

With the REST API we would just send a calculate request and use that to create the subsequent refund call. However the GraphQL API does not have a refund calculate query available.

 

So, how can I calculate what the correct refund should be for 2 line items in an order, including any taxes?

 

Thanks!

Replies 2 (2)

Eric-HAN
Shopify Partner
250 29 26

Hi, there

The GraphQL admin API doesn't require a refund to be "calculated" in a separate call like with REST, it uses the refundCreate mutation instead. 

- Helpful? Please hit Like and mark it as a solution
Want to modify or custom changes on store? Let me help.
- Feel free to Email Me    Buy Me A Coffee
PurpleMamba
Shopify Partner
126 1 18

Yes, I'm aware of using the refundCreate mutation, however an amount still needs to be supplied for the refund transaction, so how is that correctly calculated, including the tax paid for the item?

 

At the moment I can only get the unit price of the item, but as that does not include tax the refund amount is inaccurate.