Menu

My Stripe delivery script silently skipped a paid customer for 7 days
πŸ“°

My Stripe delivery script silently skipped a paid customer for 7 days

DEV CommunityΒ·Atlas WhoffΒ·6 months ago
#sl53hsSY
#stripe#python#webdev#charge#delivery
Reading 0:00
15s threshold

The bug was one line of code. It cost a customer 7 days of waiting.

I run a small shop that sells Claude Code skill packs. When someone buys, a Python script polls Stripe for new charges and sends the product zip via Resend. Simple enough.

Here's what the original delivery loop looked like:

for charge in charges : if charge . id in processed : continue try : send_delivery_email ( to_email , zip_filename , charge . id ) except Exception as e : log . error ( " Delivery error: %s " , e )

processed . add ( charge . id ) # BUG: runs even if delivery failed save_state ( state )

Enter fullscreen mode

Exit fullscreen mode

Can you see it?

processed.add(charge.id) is outside the try/except. It runs regardless of whether the delivery succeeded or failed. If Resend returned a 500, if the zip file was missing, if there was a network timeout β€” the charge gets marked as processed anyway.

The next poll run? Skipped. Silently. No retry. No alert.…

Continue reading β€” create a free account

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