---
title: "Work out every amount on the server · Agent Wranglers"
url: https://agentwranglers.se/playbook/application-security/limits-and-business-logic/server-side-business-rules
id: APS-52
level: Required
applies: payments
risk: money
updated: 2026-10-27
build: a2a6bdfed830
tokens: 855
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Work out every amount on the server

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Limits and business logic](https://agentwranglers.se/playbook/application-security/limits-and-business-logic.md).

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

- ID: APS-52
- Level: Required
- Chapter: [Limits and business logic](https://agentwranglers.se/playbook/application-security/limits-and-business-logic.md)
- Rule: Never trust a price, quantity, discount or step order sent by the browser. The server works out every amount and checks that each step happened.
- Check: Change the price to 0.01 in the request, send a quantity of -1, and reuse a single-use coupon. Each request is rejected, and the order total is unchanged.
- Risk: Money lost or taken twice
- Applies when: The project takes payments.
- How: Send only product IDs and quantities from the browser, and look up prices on the server. Reject quantities that are not whole numbers, below one or above a cap set per product, such as 99. Track each order's state, so payment cannot be skipped. Mark a coupon as used in the same step that applies it.

## 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.

### JSON example

```json
{ "items": [{ "product": "mug-blue", "quantity": -1, "price": 0.01 }], "coupon": "WELCOME10" }
```

## Sources

- [OWASP WSTG on testing payment functionality](https://wstg.owasp.org/latest/4-Web_Application_Security_Testing/10-Business_Logic/10-Payment_Functionality/)
- [CWE-602 Client-Side Enforcement of Server-Side Security](https://cwe.mitre.org/data/definitions/602.html)

## Related rules

- ECM-13 [Recheck prices and stock when the order is placed](https://agentwranglers.se/playbook/ecommerce/carts-and-checkout/recheck-at-checkout.md) in E-commerce and fulfilment
- ECM-36 [Apply discounts on the server in one fixed order](https://agentwranglers.se/playbook/ecommerce/promotions-and-claims/discount-order.md) in E-commerce and fulfilment
- ANA-3 [Record business facts on the server](https://agentwranglers.se/playbook/analytics/events-and-metrics/server-side-business-events.md) in Product analytics and experiments
- PRC-1 [Keep prices in a versioned catalogue](https://agentwranglers.se/playbook/pricing/plans-and-prices/price-catalogue.md) in Pricing, plans and entitlements

**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/application-security/limits-and-business-logic/server-side-business-rules">Agent Wranglers application security playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Keep regular expressions from stalling the server](https://agentwranglers.se/playbook/application-security/limits-and-business-logic/regex-denial-of-service.md)
- Next: [Make each change happen exactly once](https://agentwranglers.se/playbook/application-security/limits-and-business-logic/race-conditions.md)
- [Limits and business logic](https://agentwranglers.se/playbook/application-security/limits-and-business-logic.md)
