---
title: "Comment by Naval Pro on \"Why Stripe Test Mode Lies: A Solo Dev's 36-Hour Payment Infrastructure Trench Warfare\" | Hashnode"
description: "You asked about a handler skeleton and whether to store processed event ids. Yes, store them. Here's the shape I use: Check the signature on the raw body, befor"
url: "https://hashnode.com/posts/why-stripe-test-mode-lies-a-solo-dev-s-36-hour-payment-infrastructure-trench-warfare/6accab3a2cf2ed754311386a/comment/6b070349c8eb5d6e0753c225"
---

[Discussion](https://hashnode.com/posts/why-stripe-test-mode-lies-a-solo-dev-s-36-hour-payment-infrastructure-trench-warfare/6accab3a2cf2ed754311386a)

Comment [Why Stripe Test Mode Lies: A Solo Dev's 36-Hour Payment Infrastructure Trench Warfare](https://hashnode.com/posts/why-stripe-test-mode-lies-a-solo-dev-s-36-hour-payment-infrastructure-trench-warfare/6accab3a2cf2ed754311386a)

[Naval Pro](https://hashnode.com/@navalop90)

[6d ago](https://hashnode.com/posts/why-stripe-test-mode-lies-a-solo-dev-s-36-hour-payment-infrastructure-trench-warfare/6accab3a2cf2ed754311386a/comment/6b070349c8eb5d6e0753c225)

You asked about a handler skeleton and whether to store processed event ids. Yes, store them. Here's the shape I use:

Check the signature on the raw body, before you parse anything. Insert the event id into a table with a unique constraint. If the insert fails, you've seen it before, so return 200 and stop. Fetch the subscription from Stripe and write that, not the event payload. Add a revision column and update with WHERE revision = , so two handlers running at once can't overwrite each other. Return 200.

Re-fetching fixes the stale state, but it won't stop a retry from sending the same email twice. The event id table is what stops that. I put a tested version of this together for Postgres/Supabase. It's on my GitHub (navalpro8-lgtm, repo stripe-subscription-sync). It's mine, and not audited, so treat it as a reference. i couldnt paste the link so try going to my repo manually

[Naval Pro](https://hashnode.com/@navalop90)

[5d ago](https://hashnode.com/posts/why-stripe-test-mode-lies-a-solo-dev-s-36-hour-payment-infrastructure-trench-warfare/6accab3a2cf2ed754311386a/comment/6b070349c8eb5d6e0753c225#reply-6b09255ff44b2eca0a6a0fae)

@Mohan I also wrote this up on dev.to: "Deduplicating Stripe events doesn't fix out-of-order subscription updates" (author navalpro8lgtm). It covers the ordering guard, and why I re-fetch and write with a revision check instead of comparing event.created. I'd like your honest opinion, especially if something in it is wrong or unclear.
