Simple tax calculation
Let’s take a simple item, let’s say a $150 gadget, sold to a customer in California. The seller wants to calculate the tax to be collected for the transaction. They can do this by sending aPOST request to the /calculations endpoint with the following payload:
Json response
Json response
tax_due field is a string with a generous number of decimals to avoid precision issues.total_tax_due field that contains the sum of all the taxes due for the transaction.
The seller can then decide what to display to their customer and ensure they collect the correct amount ($12.94 in this case).
After the seller’s customer pays, the seller can record the transaction with the /transactions endpoint.
transaction_reference to reconcile the transaction in their own systems.
Tax calculation with multiple jurisdictions
A more complex transaction might be a sale where a product is sent to a customer in California, while another product is sent to a customer in New York. This is a common scenario for B2B sales. For example, purchasing software for various locations of a franchise.Discounts
Discounts can either be passed at the transaction-level (“10% off your entire cart”):Bundled products
Some sellers bundle products together in a single package. This is common for physical products, but can also happen for digital products. In this example we sell a computer and a software product loaded on a DVD shipped with the computer. Using theproduct.tax_attributes field, we can specify that one of the line items is a bundle of both a tangible personal property (computer) and the other is a digital good (software loaded on a DVD).