Working with Taxes using Commerce API

There are two tax calculation features available in NetSuite — SuiteTax and Legacy Taxes. SuiteTax uses internal or external tax engines to calculate taxes for transactions in NetSuite. At present, SuiteTax is available only for Commerce web stores that cater to the US and Canada. See SuiteTax and SuiteCommerce SuiteTax Support for more information about SuiteTax.

Important:

SuiteTax is not supported for tax calculation on SiteBuilder websites.

SuiteTax

SuiteTax calculates the total taxes applicable for each item in a sales order. The following methods retrieve SuiteTax tax calculations for a web store order:

  • recalculateTaxes() - triggers tax calculation for a sales order. Taxes are not calculated or recalculated unless this method is called.

  • getTaxDetails(), getTaxDetails(fields) - retrieves tax details for each line item in the sales order, including items, shipping, and handling (if set up as separate from shipping). If multiple tax types apply to a sales order, this method retrieves a taxdetails object for each tax type for each line item.

    • The taxdetailsreference field for an item in the orderitem object matches the taxdetailsreference field in the related taxdetails objects returned by getTaxDetails(). If getTaxDetails() does not return any taxdetails objects with a matching taxdetailsreference field, it means no taxes are applicable for that item.

    • The taxamount field contains the total of the taxes applicable for the item. If multiple taxes apply to a line item, this is the total amount for the tax type in the taxtype field.

  • getOrderSummary(fields) - retrieves the fields:

    • taxonshipping - shipping tax amount.

    • taxtotal - total taxes for the whole order.

  • getSummaryTaxTotals() - retrieves the tax amount per tax type for the whole sales order. If multiple tax types apply to a sales order, this method returns multiple summarytax objects.

Legacy Taxes

Note:

The field used for legacy taxes must not be used if SuiteTax is enabled.

In the United States, per item taxes are not applied to an order. Instead tax is applied to the entire order. The following tax fields are present in the orderitem object and are only used when countries require per line tax:

  • taxtype1

  • taxrate1

  • taxtype2

  • taxrate2

Since every line can have a different tax type or tax rate you should define the taxes per order line. When a line is not taxed, omit those fields.

Note:

You should also check the value of pricesincludevat in the sitesettings object to verify whether taxes are included in the price. These fields are only required when tax is not included in the price.

General Notices