On This Page
Calculating the Grand Total for Line Items
Most Thunes payment methods require the grand total amount of a purchase to be
in the request. Include the grand total in the
purchaseTotals_grandTotalAmount
request field.To calculate the
grand total amount for multiple line items, use this formula:
Here is the
same formula with the respective API fields:
item_#_unitPrice
x item_#_quantity
) for
all items + sum of (item_#_ taxAmount
) for all
itemsGrand Total Amount
This example shows the proper syntax and calculation of a grand total amount within
an API request.
Figure:
Including the Grand Total Amount in an API Request Message
<item id="0"> <unitPrice>100.00</unitPrice> <quantity>1</quantity> <productCode>123456</productCode> <productName>Shirt</productName> <productSKU>test1</productSKU> <taxAmount>15.00</taxAmount> <totalAmount>115.00</totalAmount> <productDescription>Red</productDescription> </item> <item id="1"> <unitPrice>75.00</unitPrice> <quantity>2</quantity> <productCode>654321</productCode> <productName>Pants</productName> <productSKU>test2</productSKU> <taxAmount>25.00</taxAmount> <totalAmount>175.00</totalAmount> <productDescription>Green</productDescription> </item> <purchaseTotals> <grandTotalAmount>290</grandTotalAmount> </purchaseTotals>