🎉 Celebrate with 10% OFF on All Products! Use Code: GFEX10 Or Buy Any 2+ Items for 30% OFF with Code: GFEX30!
Guides & Tutorials October 28, 2026

How to Calculate US Sales Tax in Gravity Forms with TaxJar

GravityExtra
How to Calculate US Sales Tax in Gravity Forms with TaxJar

If you collect orders, quotes, bookings or donations through a Gravity Form, there is a question you cannot avoid for US customers: how much sales tax do you actually owe? Rates change by state, county, city and special district, products are taxed differently, and the rules shift as you cross jurisdictions. Working it out by hand, or hard-coding a flat rate, is slow and risky. The Gravity Forms TaxJar Premium Add-on closes that gap: every submission is sent to the TaxJar API, which returns the exact sales tax to collect and the combined rate, and the result is kept with the entry — and, if you want, the order is recorded as a TaxJar transaction ready for reporting and filing.

Why calculate sales tax from your forms

TaxJar is a sales-tax platform that knows the current rate for any US address and how different products are taxed, all through one API. The hard part is connecting it to where your orders actually arrive. For a large number of shops, service businesses and non-profits, that is a Gravity Form: a product order, a custom quote, an event registration, a membership sign-up. This add-on wires the two together, so the tax is worked out the instant the form is submitted — no manual lookups, no guesswork, no flat rate that is wrong half the time.

A note on the TaxJar plan you need

To be clear up front: the TaxJar sales-tax API is part of a paid TaxJar Professional plan. You generate your API token from your TaxJar account once your plan includes API access, and TaxJar also provides a sandbox token so you can test without touching live data. This add-on connects to TaxJar with your own token; it does not include a TaxJar subscription and does not work around the plan requirement. If you already pay for TaxJar Professional, this add-on puts that subscription to work straight from your forms.

Calculate, or also record a transaction

Each feed does one of two things. In Calculate the tax only mode it sends the order to TaxJar and stores the tax to collect, the combined rate and the taxable amount on the entry — perfect for quoting a price, showing tax at checkout, or reporting it later. In Calculate, then record the order mode it goes further and files the order as a TaxJar transaction, using a stable transaction id built from the form and entry, so the sale appears in your TaxJar reports and is ready for filing. Because mode is set per feed, one form can quote on one feed and record on another once the order is confirmed.

What you need before you start

You need Gravity Forms 2.9 or newer, a WordPress site on PHP 7.4 or newer, and a TaxJar account on a plan with API access (TaxJar Professional). TaxJar provides a sandbox token as well as your live token, so you can build and rehearse the whole flow safely before calculating real tax. The add-on only ever contacts the TaxJar REST API at api.taxjar.com — or api.sandbox.taxjar.com when sandbox mode is on — and nothing else.

Step 1: get your TaxJar API token

In TaxJar open Account, then TaxJar API, and generate an API token. Treat it like a password: you paste it into the add-on once, and it is stored encrypted on your own site from then on. Keep a sandbox token handy too, so you can test against the sandbox host first.

Step 2: connect the add-on

In WordPress go to Forms → Settings → TaxJar, activate your GravityExtra license key, paste the TaxJar token into the token field and save. The field is a password field, the token is encrypted with AES-256-GCM before it reaches the database, and it is never shown again in clear. Tick Sandbox while testing, and the Test connection button confirms the token works — it asks TaxJar for its tax categories — without calculating anything or recording a transaction.

The TaxJar settings page in Gravity Forms: license key, TaxJar API token, sandbox toggle and a Test connection button
Paste your TaxJar API token and confirm it with Test connection.

If your server cannot encrypt secrets, the add-on tells you and lets you define the token with the GFTJ_API_KEY constant in wp-config.php instead; the token field is then replaced with a short note and nothing is stored in the database.

Step 3: add a feed to a form

Open a form, go to Settings → TaxJar, and add a feed. Choose Calculate the tax only or Calculate, then record the order. Then build the order: map the Customer address from the submission (the destination country and postal code are required, the state and city make it exact), set your Ship-from (nexus) address as fixed values, and map the Order amount and Shipping from your fields.

The TaxJar feed in Gravity Forms: calculate only or record a transaction, the order amount and the customer address
A feed maps the customer address and the order amount, and chooses calculate-only or record.

Mapping fields, line items and tax codes

Every address and amount field accepts Gravity Forms merge tags, so you build the order straight from the submission. Map the destination postal code from an address field with {Ship to (ZIP / Postal Code):3.5}, the amount from a number field with {Amount:4}, and the shipping from another. You can optionally map a single line item — a quantity, a unit price and a TaxJar product tax code — for a more exact result. A product tax code tells TaxJar how to treat the product: clothing (20010) is handled differently in some states, and many digital goods are exempt. Leave the code empty for a standard taxable product.

Step 4: test and watch the entries

Send a test submission with your sandbox token. Each entry records a note of what happened and keeps the sales tax, the combined rate, the taxable amount and — when a transaction is recorded — the TaxJar transaction id. Four merge tags, {taxjar_tax}, {taxjar_rate}, {taxjar_taxable} and {taxjar_order}, are available in your Gravity Forms notifications, so your confirmation e-mail can show the customer the tax and your team the transaction reference automatically.

A Gravity Forms entry screen showing the TaxJar note with the calculated sales tax
The entry note keeps the sales tax, the rate and a jurisdiction breakdown for your records.

Nexus, breakdowns and clear errors

TaxJar decides the tax from the destination and from where you have nexus. When there is no nexus for a destination, TaxJar returns no tax to collect, and the add-on records that clearly on the entry rather than treating it as a failure. When there is tax, a short breakdown of the state, county, city and special-district portions is stored so you can see exactly how the figure was reached. If a TaxJar call fails, the form submission is still saved — you never lose an order — and the entry note carries the HTTP status so you know whether it was an invalid token (401), an incomplete destination or amount (422), or rate limiting (429). The add-on calculates the tax once per entry and never records a transaction twice: a “done” marker and a short per-entry lock stop a resend or a retry from filing the same order again.

Where it fits: real-world examples

Because every field is mapped from the form, the add-on bends to how you actually work. A small online shop taking orders through a Gravity Form can map the customer’s address and order total, show the correct sales tax in the confirmation, and record the order as a transaction so it is ready at filing time. A business that sends custom quotes can calculate tax on a quote form so the figure the customer sees is right from the start. A membership or event site can apply the correct rate by destination, and use a product tax code for anything that is taxed differently. A non-profit can calculate tax on taxable merchandise while leaving genuine donations alone through conditional logic. In each case the tax is worked out from the data you already collect, so there is nothing to re-enter and nothing to get wrong by hand.

Tax rules stay in TaxJar, where they belong. Whatever nexus settings, product tax codes and rate rules you maintain in your TaxJar account are what the add-on uses; the feed only ever maps your fields and says calculate or record. That means you can update your nexus, add a new product category, or change how a product is taxed inside TaxJar without touching your forms.

Privacy and security

Your TaxJar API token is encrypted at rest and never shown again, never written to an entry, and never written to a log. It travels only in the Bearer Authorization header, never in the URL or the request body. The add-on fixes the host to api.taxjar.com (or the sandbox host) over https with certificate verification on, and never follows a redirect, so the token cannot be sent anywhere else. Error messages have the token stripped out before they are shown or stored. The only outbound request the add-on ever makes is to TaxJar, and if that request fails your form submission is still saved so no order is lost.

Put it to work

From a product order to a custom quote, the Gravity Forms TaxJar add-on takes the sales-tax work off your plate: calculate the right tax from the form, keep the breakdown with the entry, and record the order when you are ready. You will need a paid TaxJar Professional plan for the API. See the full setup guide for every field and option, then get the Gravity Forms TaxJar Premium Add-on and turn your next submission into an accurate tax calculation.

0
0
Your Cart
Your cart is emptyReturn to Shop
🔥 FREQUENTLY BOUGHT TOGETHER
Complete Combo & Save 40%!
ITEM IN YOUR CART
Gravity Forms Klaviyo Add-on
$39.00/yr
+
🎁 RECOMMENDED ADD-ON SAVE 40% OFF
Original Price: $39.00/yr
Bundle Special Price: $23.40/yr