Promo FTW! Codes that never quietly charge full price
Yes we have partners' promo codes. Promo codes look like a small feature: a code, a discount, done. The part that's actually hard is the failure handling -- every place a code can be mistyped or silently ignored is a place a customer gets charged full price while thinking they got a deal.
The one rule
Fail closed, never quietly. If anything in the discount path breaks -- the validation, the payment provider, the network -- then the checkout fails or the code survives for retry. What it never does is continue at full price with the discount forgotten. A customer who entered LAUNCH50 and got charged full price was misled, even if the code was "just" buggy.
The code follows you through signup
A promo link usually lands before the account exists. The flow: click a ?code= link > browse > register > verify email > log in > pick a plan > pay. That's a lot of chances to drop the code along the way.
So the code is stashed in the session the moment any page sees a well-formed ?code= -- pricing, billing, login, even the signup page itself, because promo links don't always point where you'd expect. A stash is a hint, not a trusted discount: the real validation runs at checkout, against that specific user, ordering that specific plan.
The stash clears in exactly two cases:
- The code is genuinely invalid -- expired, wrong plan, etc. Keeping it would just fail again. That's the spoiled bread scenario.
- The provider returned a checkout URL -- the discount is committed on their side; the code's job is done. That's the bread you have eaten scenario.
Everywhere in between, it survives. Provider error? Checkout fails, but code stays and retry is still discounted.
Rate limit != invalid
Don't code-guess! Code-guessing is a real thing in the wild Internets, so validation is rate-limited. But hitting the limit used to look exactly like a bad code -- and could burn a perfectly good one. Now they're separate outcomes: hit the limit, and you're told to come back later. Your code stays valid, waiting for you.
Discounts live in the provider's own books
We use a Merchant of Record (currently Creem) -- they handle the actual charging. Rather than tracking discounts in our own ledger and patching later, every valid code is mirrored into the provider's discount catalog at first checkout. Their dashboard shows what they actually charged; the money trail is real end-to-end. For the money flow you always look at the Creem dashboard.
Redemption is counted when money moves
A code counts as used when the provider's webhook says a payment happened -- not when someone types it, not when a checkout opens. Abandoned checkouts never consume a redemption.
The interesting part of promo codes was never the discount. It's making sure that at every one of the dozen places the flow can break, the customer ends up either charged correctly or clearly told why not -- never quietly charged wrong.