A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
We are using the Admin REST API to facilitate orders made through our web application.
Everything works fine for orders which require shipping, but it was recently discovered that our application was failing to complete checkouts for orders which don't require shipping (ie. non-physical goods).
In the typical checkout flow, I noticed that Checkout.totalTax is always zero until the checkout is updated with a shipping rate. However, for orders which don't require shipping (ie. Checkout.requiresShipping: false), it's not possible to fetch/set shipping rates for the Checkout. As a result, when our server attempts to apply payment for the order using Checkout.amountDue, the amount of the payment (which excludes tax) does not match the amount expected by Shopify (which includes tax), causing an error.
Sample Checkout:
{
// ... "requiresShipping": false, "shippingLine": null, "shippingRates": null, "subtotalPrice": "9.90", "taxesIncluded": false, "token": "XXX", "totalPrice": "9.90", "totalTax": "0.00" // this is always zero }
Sample payment request:
// Request:
{
"amount": "9.90",
"uniqueToken": "XXX",
"paymentToken": {
"paymentData": "XXX",
"type": "stripe_vault_token"
}
}
// Response:
{ "amount": [ { "code": "total_price_mismatch", "message": "The amount of the payment must match the total of 11.19.", "options": { "amount": "11.19" } } ] }
What's strange is that when I visit Checkout.webUrl to manually complete the order I can see the tax charge which was not included in the REST API response:
Am I missing a step in the Checkout flow in order to populate Checkout.totalTax? Or is this possibly an oversight in the REST API? Any help would be appreciated!
Best,
Tyler