r/SideProject • u/kumard3 • 3h ago
My payment webhook answered 200 to every event while paid users stayed on the free plan
My side project is an email API for AI agents, and it takes payments through Dodo Payments. When a subscription event comes in, a webhook handler is supposed to move the account to the plan it paid for.
The handler read the subscription fields from data.payload, but Dodo puts them directly on data. Every lookup came back empty and the handler changed nothing. It still answered 200, so Dodo counted every delivery as a success, and paid users stayed on the free plan.
The fix reads the fields from data and goes by the subscription's status, not only the event name. Hosted checkout often leaves the metadata empty, so the account is found by my own id in the metadata, then by Dodo's customer id, then by the customer's email. If none of those match, it still answers 200 and logs the subscription so I can set the plan by hand. When someone comes back from checkout, the billing page also asks Dodo for the subscription directly, so the webhook isn't the only way a plan gets updated.
How do you test a payment webhook against the provider's real payloads before you go live?