How to use DraftOrderCreate API to get calculated Taxes

Topic summary

A developer is attempting to use Shopify’s DraftOrderCreate API to calculate sales tax based on customer shipping addresses before processing payments through a third-party gateway. However, the API returns no tax information in the taxLines field despite valid addresses being provided.

Root cause identified:

  • DraftOrderCreate has limited tax calculation capabilities
  • Designed primarily for internal/admin use (invoices, phone orders) rather than real-time tax quotes
  • Tax lines aren’t guaranteed until the draft order is completed or invoiced
  • Calculation behavior varies inconsistently across different tax jurisdictions

Recommended solutions:

  1. Use the Checkout API (Storefront API) - most reliable option:

    • Accepts line items and shipping address
    • Returns accurate taxLines, totalTax, and totalPrice
    • Pass calculated total to payment gateway
    • Create order via Order API after payment with financial_status: paid
  2. Order API with Tax Services (Shopify Plus only)

Additional note: One participant observed that draftOrderCalculate shows tax information but it disappears when using draftOrderCreate, suggesting inconsistent behavior between related APIs. No workaround for this specific issue was provided.

Summarized with AI on October 26. AI used: claude-sonnet-4-5-20250929.

Hi community,

We are integrating Shopify in our e-commerce website and using a 3rd party payment gateway.

I am trying to do the following:

  1. Use DraftOrderCreate API to create an order, and get the tax rate from the DraftOrder based on the shipping address provided by the customer during checkout.

  2. Add the calculated sales tax to the subtotal and send the total amount to the 3rd party payment gateway for authorization and payment process (not via Shopify API)

Issues encountered, the draftOrder doesn’t contain any tax information in the taxLines field even though a valid shipping address is provided. How can we get the tax rate or calculated taxes from this API?

Thanks,

1 Like

Hello @ezup

You’re on the right track with using the DraftOrderCreate API for Shopify, but there’s a limitation: DraftOrderCreate does not automatically calculate tax lines unless certain conditions are met.

Here’s a breakdown of why you’re not seeing tax info — and how to get calculated taxes properly for use with a 3rd party payment gateway:

Why DraftOrderCreate isn’t returning taxes:

  1. Taxes are calculated only when the use_customer_default_address or full tax-relevant data is passed, and even then, only if Shopify can determine the tax jurisdiction.

  2. Shopify doesn’t calculate tax lines for draft orders the same way it does for checkout or order APIs.

  3. Most importantly: taxes on Draft Orders are not guaranteed to be calculated until the order is completed or the invoice is sent.

Solution: Use the Checkout API or Order/Tax Services API instead
If your goal is to retrieve tax calculations before processing payment externally, this is the more reliable route:

Option 1: Use the Checkout API
The Checkout API (Storefront API) will:

. Accept full line items and shipping address

. Return a checkout object with accurate taxLines, totalTax, and totalPrice

Example mutation:

graphql…

mutation checkoutCreate($input: CheckoutCreateInput!) {
  checkoutCreate(input: $input) {
    checkout {
      id
      totalTaxV2 {
        amount
      }
      totalPriceV2 {
        amount
      }
    }
    checkoutUserErrors {
      field
      message
    }
  }
}

You’ll pass in:

. Line items (variant IDs + quantity)

. Shipping address

. Email (required)

Option 2: Use the Order API with Tax Services (Only for Shopify Plus)
If you’re on Shopify Plus, you may be able to use custom tax services or Orders API with tax overrides — but for most stores, Checkout API is the only reliable pre-payment tax calculator.

Why not to rely on DraftOrder for tax estimates
. DraftOrder was designed for internal/admin use (e.g., invoices or phone orders), not real-time tax quotes.

. Its tax calculation behavior is limited and inconsistent across store setups (e.g., US vs. EU vs. Canada).

Your Best Workflow (Recommended)

  1. Use Storefront checkoutCreate mutation with full shipping address

  2. Get the accurate totalTax and totalPrice

  3. Pass that totalPrice to your 3rd-party payment gateway

  4. After payment, use the Order API to create an order with financial_status: paid and the externally processed payment details

Thank you :blush:

It’s weird. When using draftOrderCalculate I can see the tax included but it’s dropped when using draftOrderCreate. Is there any workaround to get the tax included>