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.

refundCreate Tax

refundCreate Tax

dpiccolo
Shopify Partner
5 0 3

I am using the admin api graphql refundCreate mutation to refund line items and shippings, it works fine except I can't figure out how I'm suppose to refund taxes. Is it even possible with refundCreate or do I need to use the REST api? Can someone please provide some guidance.. I've been searching exhaustively for an answer. Thank you.

Replies 3 (3)

lizk
Shopify Staff
246 58 78

Hi there! 👋

When you refund with the refundCreate mutation and you refund LineItems it should automatically calculate and refund the associated tax for that line item. Similar to how this functions when performing refunds in the Shopify Admin.
Try this out, and let me know if this it is working as you expected.

To learn more visit the Shopify Help Center or the Community Blog.

dpiccolo
Shopify Partner
5 0 3

Thank you so much for replying!

 

I'm not seeing this behaviour, I made a test order by placing a real order on a credit card, I refunded a taxable product whose line item had tax lines with a monetary value above $0.00.

 

The product cost was $4.87 per unit, I refunded a quantity of 6, so my refund transaction amount was $29.22.

 

When this refund appeared on the credit card statement (below) it was $29.22, Shopify did not automatically add the tax to the refund amount.

dpiccolo_0-1687382774872.png

 

This is the refund notification email I received from Shopify:

dpiccolo_1-1687382963736.png

 

I will note that Shopify did recalculate the taxes on the order itself, but it did not refund the taxes paid on this credit card.

 

This is the graphql variable I passed to the refundCreate request:

$totalUnitRefundAmount=29.22;
$totalUnitShippingAmount=0;

$variable=[
	"input" => [
		"orderId" => $orderId,
		"currency" => $currency,
		"note" => "",
		"notify" => true,
		"refundLineItems" => [
			[
				"lineItemId" => $lineItemId,
				"locationId" => $locationId,
				"quantity" => (int) $quantity,
				"restockType" => "RETURN",
			]
		]
		"shipping" => [
			"amount" => (string) $totalUnitShippingAmount,
		],
		"transactions" => [
			"amount" => (string) ($totalUnitRefundAmount + $totalUnitShippingAmount),
			"kind" => "REFUND",
			"gateway" => "shopify_payments",
			"orderId" => $orderId,
			"parentId" => $transactionId
		]
	],
];

 

Can you help me understand where I'm going wrong? My hope is that Shopify would automatically calculate the taxes on both the line item and shipping and add them to the refund amount.

 

I really appreciate that you took the time to respond, any insight you can provide would be welcome. Thank you!

dpiccolo
Shopify Partner
5 0 3

Hi Lizk, I just wanted to follow up on my other reply in this thread, does anyone have information on this issue? Thanks.
https://community.shopify.com/c/customers-discounts-and-orders/refundcreate-tax/m-p/2112334/highligh...