How should I handle discounts in the API?

For many merchants, there are a variety of scenarios where discounts may apply. Understanding this, our API is built to handle discounts for your orders!

Communicate Discounts at the Line Item level

Discounts are communicated in the TaxJar API on the line_items. If you have a discount for a specific item, include the discount amount using the discount parameter on the applicable line_item as a positive value. Discounts are communicated as a total discount for the item and are not unit based. 

So if you have an item listed for $10 with a $2 discount, and the order includes a quantity of 3 for this item, then you would list this as a discount of $6. 

How do I handle discounts not associated with a particular Line Item?

For order wide discounts you will want to split the discount amount evenly among the line items.  So if you have an order with a $15 discount where three separate items are included you would send in a discount of $5 for each item.

What does this look like when I push an order in with /v2/transactions/orders?

Similar to the sales tax calculations using /v2/taxes above, you will want to send in the discount at the line_item level with any order wide discounts split among the line_items. When pushing an order in to TaxJar using /v2/transactions/orders, the amount parameter must match the total of the line_items + shipping. So for this scenario assuming shipping is $0 you would send an amount of $30 which reflects the applied discount.