A late subscription event can overwrite a newer access decision if the application treats delivery order as business order. The webhook endpoint should not simply assign the last received payload to the customer's current entitlement.
Define how provider state becomes application access, then make event processing tolerant of delayed delivery. The goal is a correct current entitlement with enough history to explain how it was reached.
Separate event receipt from state authority
Record the event identity, provider account, affected object, event type, receipt time, and processing outcome. Keep provider event time distinct from receipt time. Verify incoming events according to the provider's documented mechanism before accepting them as trusted input.
The official Stripe webhook guide documents delivery considerations, including ordering. Other providers have their own contracts. Do not assume arrival sequence is a reliable version number across all event types.
Test a fictional upgrade followed by cancellation
Suppose a customer upgrades a plan and later schedules cancellation. The cancellation-related update arrives first, followed by an older upgrade update. A naive handler may remove the scheduled end date or restore a previous plan state.
Build a sandbox fixture with the intended final provider state and deliver related events in several orders. Verify the application's plan, access scope, effective end date, and audit history. Add a repeated event and an event for a different subscription under the same customer.
Choose a reconciliation strategy appropriate to the provider: for example, use a trusted event to trigger retrieval of the current relevant object, then apply a defined state transition. Even that strategy needs checks for races, object relationships, and temporary provider failure. It is not a universal one-line fix.
Keep access semantics explicit
A cancelled renewal instruction may still leave access valid until the paid period ends. An incomplete purchase may not grant access at all. Map provider states to your own product policy rather than using one global paid boolean.
Preserve failed processing for retry or review. Acknowledging receipt and discarding a reconciliation error can create a permanent mismatch. Support needs to see both the last received event and the last successfully established entitlement.
The tradeoff is current-state lookup versus dependency and workload. Fetching authoritative state can simplify some ordering problems but adds provider calls and failure paths. A carefully versioned local model may be appropriate elsewhere. Test the actual strategy with delayed and competing events.
The StackFlight case study provides related paid-access context. This subscription sequence is fictional and does not describe its current billing model or an incident there.
Questions about webhook ordering
Can receipt timestamps determine the newest subscription state?
Not reliably. They describe when your endpoint saw an event, not necessarily when the relevant business transition occurred.
Should every event directly change access?
No. Some events are signals to reconcile or update a narrower record. Define which facts establish entitlement under your integration.
What should a regression case assert?
Assert the final plan, effective dates, access rights, and audit outcome across event permutations. Bring inconsistent cases to a billing integration review.