Skip to main content

Overview

When calculating taxes or posting transactions to Zamp, take a look at this guide for how the math works for item values and totals.
Zamp’s APIs accept up to the cent (second decimal place) for transaction-level financial values. Otherwise, we will return a Number must be a multiple of 0.01 error. Line item amounts can be to the 4th-decimal place.

Transaction Total

At the transaction-level, the total is the aggregate of the item costs minus discounts, any shipping and / or handling, and tax collected. Zamp will validate the totals being passed on calculation and transaction posting attempts. Total=sum(lineItems.amountβˆ—lineItems.quantity)βˆ’discounts+taxCollectedTotal = sum(lineItems.amount * lineItems.quantity) - discounts + taxCollected

Calculating Item Cost with Discounts

  • I have a transaction for 2 of the same item.
    • They cost $10 each.
  • There is a promotion running for $10.00 off your cart.Β 
  • The item cost for this transaction is $10.
(10.00βˆ—2)βˆ’10.00=10.00(10.00 * 2) - 10.00 = 10.00
  • I have a transaction where 3 different items are being sold.
    • Item A is $10, and the customer ordered 1.
    • Item B is $15, and the customer ordered 3.
    • Item C is $20, and the customer ordered 2.
  • There is an additional 20% discount for the cart.
  • The item cost for this transactions is $75.00
(10.00βˆ—1)+(15.00βˆ—3)+(20.00βˆ—2)βˆ’20.00=75.00(10.00 * 1) + (15.00 * 3) + (20.00 * 2) - 20.00 = 75.00
  • I have a transaction for 3 of the same item.
    • The item costs $10.00.
  • There is a β€œBuy Two Get One Free” promotion, so the discount is $10.00.
  • The item cost for the transaction is still $20.00, but there is no transaction-level discount value since it is factored in at the line-item.
(10.00βˆ—3βˆ’10.00)=20.00(10.00 * 3 - 10.00) = 20.00

Calculating Totals

  • I have a sale with a single line item worth $20.00.
    • It costs $1.50 to ship.
    • It costs $1.00 to handle.
    • It has $2.00 of tax calculated.
  • The total for this transaction is $24.50.
20.00+1.50+1.00+2.00βˆ’total(24.50)20.00 + 1.50 + 1.00 + 2.00 - total (24.50)
  • I have a sale with 3 line items.
    • Each cost $10.00.
    • It costs $5.00 to shipΒ ANDΒ handle.
    • The tax calculated is $3.00.
  • The total for this transaction is $38.00.
(10.00βˆ—3)+5.00+3.00=total(38.00)(10.00 * 3) + 5.00 + 3.00 = total (38.00)
Last modified on October 13, 2026