Apply Catalog Taxes to Orders

Applies to: Orders API | Catalog API

Learn how to create orders with automatically applied catalog taxes.

Link to section

Overview

Pricing options configured for an order affect the order's price calculation. Use the pricing option to have Square apply catalog-defined taxes to line items, whether they're ad hoc items or based on catalog item variations.

Before this automatic tax application feature was available, your application relied on the presence of an order.taxes object in the order as shown in the following example:

{ "taxes": [ { "uid": "STATE_SALES_TAX_UID", "catalog_object_id": "BME4AVPBJG7ZCMJAK3PCQGK4", "scope": "ORDER" } ] }

If the order.taxes property isn't present in a CreatOrder request, Square cannot apply a tax to the order. For more information about manually taxing an order, see Apply taxes and discounts.

Instead of adding an order.taxes property to a CreateOrder request, add the order.pricing_options property as shown in the following example:

{ "pricing_options": { "auto_apply_discounts": true, "auto_apply_taxes": true } }

When taxes are automatically applied, Square gets tax information from the seller's catalog. For catalog-based line items, taxes associated with the catalog item are applied. For ad hoc items, Square applies all CatalogTax objects that can be applied to custom amounts.

Important

If your CreateOrder request includes the order.taxes and order.pricing_options.auto_apply_taxes properties, the resulting order includes both types of taxes. This might result in the same taxes being applied twice to an order.

The following CreateOrder request creates an order for a cup of coffee, which is taxed twice. There's an automatically applied line item tax for the tax associated with the coffee catalog item and there's an order tax manually applied to the order:

Create order

Link to section

Ad hoc line items

If a seller wants to charge an arbitrary amount on an order without referencing an item from the catalog, they create an order line item without first selecting one from the Item library. In the order.line_items[].name property, your application uses whatever item name and price the seller inputs.

For example, a buyer gets a pair of socks from a sale bin on the sidewalk in front of a store. All the socks in the bin are discounted to $1 and are no longer in the catalog. The clerk types "socks" in the checkout page of your application and inputs $1.00. Your application creates an ad hoc item with the name "socks" and a custom price of 100 ($1.00).

The order.line_items[].base_price_money property holds whatever amount the seller wants to charge. It has a custom amount because the base price doesn't come from the catalog. The ad hoc line item doesn't reference a catalog item variation. For more information about taxing ad hoc items, see Catalog taxes.

Link to section

Catalog taxes

Before your application can apply preconfigured taxes to an order, the seller needs to define one or more CatalogTax items. The CatalogTax has properties that define how the tax is calculated in an order. However, the property that differentiates a catalog tax that applies to catalog items and a tax that also applies to ad hoc items is the applies_to_custom_amounts Boolean property.

The following two tax object examples show both types of catalog taxes:

This tax doesn't apply to ad hoc line items.

Important

The default value of a new CatalogTax.applies_to_custom_amounts property is true. You need to set "applies_to_custom_amounts": false in your UpsertCatalogObject request if you want the tax to apply to only catalog-item-based line items.

Link to section

Taxing for ad hoc items

When your application creates an order that specifies a line item without referencing a catalog item variation, but just supplies an item name, quantity, and base price, it's creating an ad hoc item as shown in the following example CreateOrder request and response.

The following request shows an order for a pair of bright red wool socks from the sale bin in front of the store. Because the seller defined the 40% catalog tax (shown previously) and this order is asking for an automatically applied tax, Square applies all applicable taxes as shown in the response.

Link to section

Taxing for catalog-based line items

First, create the products you want to sell and a tax you want to use. Then, create example orders to explore how having Square apply preconfigured taxes affects the order's pricing calculation:

  • Create an order for coffee. In the request, specify the pricing option for Square to apply a preconfigured tax. The tax applies to all line items in the order.
  • Update the order to remove the Square-applied tax from specific line items.
  • Create an order with Square-applied taxes enabled, but block specific line items.

For more information, see Square applies taxes and discounts.

Link to section

Create a coffee product for sale

Call BatchUpsertCatalogObjects to create two items in the catalog:

  • A CatalogTax object with a 10% tax that applies to all line items.
  • A CatalogItem coffee object with the tax enabled.

Batch upsert catalog objects

In the response, verify that the catalog objects are created. The coffee items (of the ITEM type) should have the tax_ids field showing the tax enabled on it.

You need the coffee item variation ID to place the coffee order in the next step.

Note

If you created the two taxes shown in Catalog taxes, both apply to this example. "applies_to_custom_amounts": true means the tax applies to catalog items and ad hoc items. "applies_to_custom_amounts": false means the tax applies to only catalog items.

Link to section

Test Square-applied taxes

Link to section

Create an order with Square-applied taxes enabled

Call CreateOrder to create an order for a cup of coffee. In the request, include pricing_options to enable auto_apply_taxes.

Create order

In the response, see how pricing calculations are affected by Square's application of preconfigured taxes for the item. For example:

  • The line item includes applied_taxes, which identifies the applied taxes.
  • The order includes taxes, which provides details about the applied taxes.

Square calculates taxes using rounding rules known as Bankers' Rounding. For information about these rounding rules, see Rounding rules.

The following example response shows a partial Order object with only the relevant fields:

Link to section

Update an order to remove previously applied taxes

You can call UpdateOrder to remove specific taxes applied to specific line items. Add fields_to_clear to identify specific line items and specific the taxes to remove. Update the preceding order by removing the specific taxes applied to the line item.

Make sure you provide the order ID, location ID, line item ID, and ID of the applied tax that you want to remove.

Update order

In the response, review the pricing calculation updates. For example:

  • The line item includes pricing_blocklists, showing the taxes that are blocked from being automatically applied.
  • The specific line item shows no taxes and the order pricing is updated accordingly.

The response shows the line item with specific taxes blocked that were previously applied.

Link to section

Create an order with Square-applied taxes enabled, but block specific line items

Call CreateOrder to create an order for the coffee. In the request:

  • Specify pricing_options for Square-applied taxes.
  • For the specific line item, add pricing_blocklists and include the ID of the CatalogTax object to block it from having taxes applied by Square.

Make sure you provide the coffee item variation ID, location ID, and ID of the tax (you previously created) that you want to block from application by Square.

Create order

In the response, verify the pricing calculations. Because you blocked the line item from having taxes applied by Square, there are no taxes applied. The following is an example response fragment: