Menu

Discount codes that survive an abandoned checkout
📰

Discount codes that survive an abandoned checkout

DEV Community: postgres·Sarthak Kundu·3 days ago
#kBwOo7nn
#devtopostgresql#devto#dev#code#checkout
Long article (1128 words) — no AI summary yet.
Reading 0:00
15s threshold

A limited discount code looks like a counter: "first N people get it". Then someone opens checkout, sees the payment form, and closes the tab. Did they use the code?

If you count that as a use, a handful of people who never paid can burn through the whole allowance and real customers get "code used up". If you don't count it, two people can both be mid-checkout on the last slot and both pay.

I hit this while building a launch discount for Freveo , a workspace for freelancers. The fix was to stop thinking of a redemption as a counter and give it a lifecycle.

A redemption has three states

export const DISCOUNT_REDEMPTION_STATUS = [ "pending" , "confirmed" , "released" ] as const ; export const DISCOUNT_RELEASE_REASONS = [ "expired" , "failed" , "staff" ] as const ;

Enter fullscreen mode

Exit fullscreen mode

pending : a hold.…

Continue reading — create a free account

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