---
title: "Show the total price with every mandatory · Agent Wranglers"
url: https://agentwranglers.se/playbook/payments/checkout-and-card-data/total-price-upfront
updated: 2026-10-21
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Show the total price with every mandatory fee

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Checkout and card data](https://agentwranglers.se/playbook/payments/checkout-and-card-data.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers). Updated 2026-10-21.

- ID: PAY-58
- Level: Required
- Chapter: [Checkout and card data](https://agentwranglers.se/playbook/payments/checkout-and-card-data)
- Rule: Every price you list or advertise includes each fee the customer cannot avoid, such as service, booking or handling fees. Add later only what the law allows, such as US sales tax or shipping of physical goods.
- Risk: A law broken
- Applies when: The project takes payments.
- How: California's honest pricing law, Civil Code 1770(a)(29), applies from 1 July 2024 to online and physical shops. It bans a listed price that leaves out a mandatory fee. Showing the fee later in checkout does not cure it. A card fee counts as mandatory when cards are the only way to pay. In the EU, the Consumer Rights Directive asks for the total price with every extra charge before the order, next to the pay button. The US FTC fees rule, in force since 12 May 2025, sets the same bar for event tickets and short stays. Optional extras stay out of the price and need the customer's own choice, never a ticked box. Build each listed price and the checkout total from one server function, so they cannot drift. Tax display per market is in [Show prices the way each market expects](https://agentwranglers.se/playbook/payments/tax/tax-inclusive-prices). Card fees in the EU are in [Adding a fee for paying by consumer card in the EU](https://agentwranglers.se/playbook/payments/amounts-and-orders/no-card-surcharge).
- Check: A test puts each product in the cart with no optional extras. The checkout total minus tax and shipping equals the product page price in minor units. A catalogue query finds no mandatory fee left out of a listed price.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### JavaScript example

```js
function listedPriceMinor(product) {
  const mandatoryFees = product.fees.filter(fee => fee.mandatory)
  return product.amountMinor + mandatoryFees.reduce((sum, fee) => sum + fee.amountMinor, 0)
}

test('the checkout total matches the listed price', async () => {
  const cart = await createCart([{ productId: 'bread-box', quantity: 1 }])
  expect(cart.totalMinor - cart.taxMinor - cart.shippingMinor).toBe(listedPriceMinor(breadBox))
})
```

### Python example

```python
def listed_price_minor(product):
    mandatory_fees = [fee for fee in product.fees if fee.mandatory]
    return product.amount_minor + sum(fee.amount_minor for fee in mandatory_fees)

def test_checkout_total_matches_listed_price():
    cart = create_cart([{"product_id": "bread-box", "quantity": 1}])
    assert cart.total_minor - cart.tax_minor - cart.shipping_minor == listed_price_minor(bread_box)
```

## Sources

- [California Attorney General, SB 478 hidden fees](https://oag.ca.gov/hiddenfees)
- [Your Europe, e-commerce and distance selling](https://europa.eu/youreurope/business/selling-in-eu/selling-goods-services/ecommerce-distance-selling/index_en.htm)

## Related rules

- [Show prices the way each market expects](https://agentwranglers.se/playbook/payments/tax/tax-inclusive-prices) in Payments
- [Adding a fee for paying by consumer card in the EU](https://agentwranglers.se/playbook/payments/amounts-and-orders/no-card-surcharge) in Payments

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/payments/checkout-and-card-data/total-price-upfront">Agent Wranglers payments playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Say on the order button that the order costs money](https://agentwranglers.se/playbook/payments/checkout-and-card-data/order-button-label)
- Next: [Get consent before digital content or a service starts early](https://agentwranglers.se/playbook/payments/checkout-and-card-data/early-start-consent)
- [Checkout and card data](https://agentwranglers.se/playbook/payments/checkout-and-card-data)
