Checkout prices, totals and discounts taken from the browser

Last updated November 13, 2026
Steps
- Test it: add an item, open dev tools, and replay the checkout request with a lower price, a changed total, a quantity of 0 or -1, or a coupon that shouldn't apply. If the payment page or order shows your edited numbers, the server trusts the browser.
- Send only product IDs, quantities and coupon codes from the browser. Never send prices, totals or discount amounts.
- On the server, look up each price from your database or use predefined Stripe Price IDs, then calculate the total yourself.
- Validate quantities (whole numbers, at least 1, within stock and per-order limits) and check every coupon rule on the server: expiry, minimum spend, eligible items and one use per customer.
- Create the Stripe Checkout Session on the server. Only use inline price_data for truly dynamic prices, and compute those on the server too.
- Fulfill orders from a verified Stripe webhook, not the success page. Retrieve the session with line items, check payment_status, and make fulfillment safe to run twice.
- Compare what was paid with what you expected before shipping or granting access, and alert on mismatches.
Why it matters
MITRE tracks this as CWE-602 (Client-Side Enforcement of Server-Side Security), updated in CWE 5.0 on October 28, 2026. It describes software that relies on the client to enforce protections, which attackers bypass by changing the client or sending requests directly. MITRE's mitigation is to repeat every client-side check on the server, and it lists CVE-2024-50653 as an example, where a coupon-use limit was only enforced in the front end. It maps to OWASP Top 10 2025 A06 Insecure Design. Stripe's own quickstart creates Checkout Sessions on the server and says you'll typically use a predefined Price ID, with price_data for dynamic pricing. Stripe's fulfillment guide says webhooks are required for fulfillment, because customers aren't guaranteed to reach your success page, and that fulfillment should check payment_status and handle being called more than once.
Sources
MITRE CWE-602: Client-Side Enforcement of Server-Side Security — https://cwe.mitre.org/data/definitions/602.html
Stripe Docs: Payments quickstart (Checkout Sessions) — https://docs.stripe.com/payments/quickstart
Stripe Docs: Fulfill orders — https://docs.stripe.com/checkout/fulfillment
Checked at the source on October 31, 2026.
Related patterns
Found a problem you'd rather not fix yourself?
Tell us what's wrong. A StorenTech engineer reviews your app and replies with a fixed quote, so you know the cost before any work starts.
Get it fixed by StorenTechVibe Security Weekly
One email a week with new failure patterns and how to fix them.
By joining you agree we may email you this newsletter. See our privacy policy. Free. Unsubscribe anytime. We'll never sell your email.