How Notifio routes two Stripe products through one webhook without mixing them up
Notifio offers two one-time payments — a lifetime monitoring licence and an auto-reply upgrade — both priced at £20 and both processed via Stripe's single checkout.session.completed event. Because the same event handles both products, the webhook must reliably distinguish between them to avoid issuing a duplicate licence to a customer who only paid for an upgrade. The solution uses a metadata field with a shared constant to tag upgrade sessions, allowing the webhook to identify and handle upgrades first before falling through to the default licence logic. The upgrade branch exits immediately with a return statement, ensuring the two fulfilment paths never merge. Idempotency is enforced through a unique database constraint on the Stripe session ID, protecting against duplicate fulfilment in the event of webhook retries.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in