Menu

Post image 1
Post image 2
1 / 2
0

Never trust the client with your Stripe price

DEV Community·Dmitry Bezly·about 1 month ago
#adXRPSH8
#comment#stripe#security#plan#checkout#amount
Reading 0:00
15s threshold

I was reading a Stripe tutorial last week and watched the author write amount: req.body.amount . That single line lets any user buy Premium for $1. It's also a common pattern in Stripe Checkout starter code. This post is about why, and how to make it impossible. The setup You're building a paywalled product. You wire up Stripe Checkout, follow a popular tutorial, ship it. Looks great. Tests pass. Users are paying. Six months later, someone opens DevTools, edits the request body, and pays €1 for your Premium plan. Your Stripe dashboard shows a successful charge. Stripe doesn't validate your business logic. It charged what it was told to charge. Your database shows a Premium subscription. Your billing logic is doing exactly what you wrote. This is price tampering . It happens at the one line where the server decides what to charge. The vulnerable pattern Here's the shape of the bug. Paraphrased from a tutorial I won't link.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More