A customer returns from checkout, and the browser says payment succeeded. If the application grants access solely from that redirect, it is trusting a user-controlled part of the journey to establish a billing fact.
Paid access should follow verified provider information and an explicit entitlement policy on the server.
Separate payment state from product access
The payment provider records transactions and subscription events. Your application decides what those states allow a particular account to use.
Stripe's webhook documentation explains event delivery and verification, while its subscription webhook guide describes subscription-related events. These are proposed implementation references, not a claim that every project in my portfolio uses Stripe.
Verify identity and map the purchase to the right account
Use the provider's documented signature-verification mechanism and protect its secret. Preserve the request data in the form verification requires before unrelated parsing changes it.
Then resolve the provider customer and purchased product against your server-side account mapping. Do not grant a paid tier from a browser-supplied price name or organisation identifier.
| Boundary | What must be established |
|---|---|
| Event authenticity | The message is from the configured provider |
| Account mapping | The purchase belongs to the intended application account |
| Billing state | Current verified transaction or subscription state |
| Entitlement policy | Which features that state permits |
| Processing record | How repeats and failures are handled |
Design for repeated and out-of-order events
Keep a durable processing reference. Repeated delivery should not create duplicate access grants or repeat unrelated side effects.
Do not assume event arrival order always matches the business sequence. Where necessary, obtain the relevant current provider state and apply a documented policy rather than blindly overwriting local access with the last event received.
Consider cancellation timing, trial expiry, refunds, failed renewal, and grace periods. Those choices should be explicit product rules, not accidental consequences of whichever webhook the developer implemented first.
Make pending confirmation understandable
If the customer returns before verified processing finishes, show a pending state and a refresh or support path. Avoid claiming the purchase failed when confirmation is simply delayed.
Persist enough information to reconcile provider and application records. A lost webhook should not leave a paying customer permanently locked out without an operational route to repair access.
Use the provider's test facilities for successful, delayed, repeated, invalid, and out-of-order events. Also test a purchase for another organisation and verify that the wrong account receives no access.
The SaaS project-brief article explains why billing and ownership belong in initial scope. The permission guide covers enforcing the resulting access when a user performs an operation.
Payment-access questions
Is a successful redirect sufficient proof of payment?
No. Confirm through trusted provider data and server-side mapping.
Should every failed renewal immediately erase customer work?
Access and retention are separate policies. Define them deliberately.
What should a founder ask to review?
Request test purchases, delayed confirmation, cancellation, and reconciliation behaviour before launching paid access.