Keep shipping and tax calculation server-controlled. Create reusable shipping and tax rates, select them using the order and destination, and show the resulting breakdown before creating a session.

Create rates

Build the checkout total

Resolve line items, discounts, shipping, and tax from your trusted records. Use integer minor-unit arithmetic and persist the calculation inputs. The amount sent to checkout must equal the order total you will later compare during webhook processing. When the customer changes address or delivery option, recalculate and create or update the session according to your integration flow. Do not let a stale browser total authorize fulfillment.

Compliance and display

Show whether tax is inclusive or added, the currency, delivery charge, and final total. Collect only the address fields required by your tax and shipping policy. Store sensitive personal data only in approved systems and keep it out of metadata and logs.