On This Page
Calculating the Grand Total Amount
Klarna requires that the grand total amount of a purchase be included in the request
using the
orderInformation.amountDetails.totalAmount
field. The
country of the transaction and the use of coupons affect how to calculate the grand
total amount. US Grand Total with Coupons
To calculate the grand total amount
for US transactions with coupons, use this formula:
sum of
(unit price x quantity) for all items + item-level tax amount – sum of
(
coupon
amount x quantity) for all items – item-level discount
amountThis is the same formula with the respective API
fields:
sum of (
orderInformation.lineItems[].unitPrice
x
orderInformation.lineItems[].quantity
) for all items +
orderInformation.amountDetails.taxAmount
– sum of coupons
(orderInformation.lineItems[].unitPrice
x
orderInformation.lineItems[].quantity
) –
orderInformation.amountDetails.discountAmount
US Grand Total Amount with Coupons
This example shows the proper syntax and calculation of a grand total amount within
an API request.
{ "orderInformation": { "lineItems": [ { "productName": "test-product-1", "quantity": 5, "productDescription": "description-123", "unitPrice": "20", "taxAmount": "10", "totalAmount": "100", "typeOfSupply": "01" }, { "productName": "test-product-2", "quantity": 1, "productDescription": "description-456", "unitPrice": "5", "taxAmount": "1", "totalAmount": "6", "typeOfSupply": "01" }, { "productName": "test-product-3", "quantity": 2, "productDescription": "description-789", "unitPrice": "4", "taxAmount": "2", "totalAmount": "10", "typeOfSupply": "01" } ] } }
US Grand Total without Coupons
To calculate the grand total amount
for US transactions without coupons, use this formula:
This is
the same formula with the respective API fields:
sum of (
orderInformation.lineItems[].unitPrice
x
orderInformation.lineItems[].quantity
) for all items +
orderInformation.amountDetails.taxAmount
–
orderInformation.amountDetails.discountAmount
Grand Total Amount
This example shows the proper syntax and calculation of a grand total amount within
an API request.
{ "orderInformation": { "amountDetails": { "totalAmount": "135", "discountAmount": "30", "taxAmount": "15" }, "lineItems": [ { "quantity": "4", "unitPrice": "25", "totalAmount": "100" }, { "quantity": "5", "unitPrice": "10", "totalAmount": "50" } ] } }
Non-US Countries Grand Total with Coupons
To calculate the grand
total amount for non-US transactions with coupons, use this formula:
This is the same
formula with the respective API fields:
sum of (
orderInformation.lineItems[].quantity
)
for all items + sum of (orderInformation.amountDetails.taxAmount
)
for all items – sum of coupons
(orderInformation.lineItems[].unitPrice
x
orderInformation.lineItems[].quantity
) for all items –
orderInformation.amountDetails.discountAmount
Grand Total Amount
This example shows the proper syntax and calculation of a grand total amount within
an API request.
{ "orderInformation": { "amountDetails": { "totalAmount": "135", "discountAmount": "30" }, "lineItems": [ { "quantity": "4", "unitPrice": "25", "totalAmount": "110", "taxAmount": "10" }, { "quantity": "5", "unitPrice": "10", "totalAmount": "54", "taxAmount": "5" } ] } }
Non-US Countries Grand Total without Coupons
To calculate the
grand total amount for non-US transactions without coupons, use this formula:
This is the same formula with the respective API
fields:
sum of
(
orderInformation.lineItems[].quantity
) for all items + sum
of (orderInformation.amountDetails.taxAmount
) for all items
Grand Total Amount
This example shows the proper syntax and calculation of a grand total amount within
an API request.
{ "orderInformation": { "amountDetails": { "totalAmount": "165" }, "lineItems": [ { "quantity": "4", "unitPrice": "25", "totalAmount": "110", "taxAmount": "10" }, { "quantity": "5", "unitPrice": "10", "totalAmount": "55", "taxAmount": "5" } ] } }