Money & Payments ยท zero-dependency ยท MIT

larzcart

Compute an order total the right way, to the cent.

Runs the checkout pipeline explicitly - line items to subtotal, discount, tax on the discounted amount (optionally on shipping too), then shipping - and returns a breakdown that always reconciles. Rounds each step half-up and stops a fixed discount from exceeding the subtotal.

larzscript pkg install cart
View on GitHub →Learn the stack

What you get

Try it

import "cart" as cart
let r = cart.total(4250, 500, 825, 599, false)
print("subtotal:", r["subtotal"], "discount:", r["discount"], "tax:", r["tax"], "shipping:", r["shipping"])
print("total:", r["total"])
Output
subtotal: 4250 discount: 500 tax: 309 shipping: 599
total: 4658

Why it's in the Larz Stack

larzcart is a real Larzscript package (larzscript pkg install cart) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.