Our entire Stripe integration consists of 10 slices.
No webhook nightmares. No 2am production bugs. No āoh shit, we didnāt think about thatā moments three months in.
Itās boring. Straightforward. And thatās exactly what weāre proud of.
Six Months Ago
We identified a problem in the market and founded a company to solve it. We built a SaaS platform where payments arenāt optional. Users buy licenses, activate seats, scale up and down as their needs change. We needed a payment system that could handle this cleanly.
Why Stripe?
The answer seemed obvious - Stripe is easy to integrate and provides everything we need. We also leveraged Supabaseās Stripe integration to avoid webhook hell.
But hereās what most people miss: we didnāt let Stripe dictate our model.
We knew our payment flow long before we ever touched Stripeās API.
Event Modeling First
We event modeled the entire system before writing a single line of code. And hereās the key insight that changed everything:
The information flow doesnāt change if you switch payment providers - if you model it right.
This isnāt about making our model adhere to Stripe. Itās about using Stripe to fulfill our model. Our domain speaks one language. Stripe speaks another. We control the translation.
Those 10 clean slices cover the entire payment lifecycle. Each one is a discrete, manageable piece. The picture is from our Event Model.
How It Actually Works
Let me give you a concrete example of one flow:
A user activates a seat in the platform. This fires a āUser Activatedā event in our system. That event populates a TODO list called āLicense Quantity to Update.ā An automation watches this list and updates the quantity in Stripe. When Stripe processes it successfully, a āQuantity Updatedā event fires back into our system.
Technically we donāt react to webhooks, we watch a subscriptions table for updates. Clean and simple.
Clean handoff. Clear boundaries. No confusion about where our domain ends and the external system begins.
When Things Go Wrong
Hereās the reality - external integrations always fail sometimes. APIs go down. Payment methods get declined. Networks timeout.
But hereās the beauty of thinking this through up front: it forces you to model the process, not just handle exceptions.
Business doesnāt know exceptions. They only know processes.
So whatās the process when Stripe rejects a quantity update? In our case, we automatically remove the last ordered license seats. Simple. Because we use event sourcing, we know exactly what happened - we just replay the state and reverse it.
But itās not quite that simple, is it?
What if the user already invited someone to that seat? What if they got a confirmation email? What if theyāve already started using it?
We mapped all of this out during event modeling - long before we wrote code. We played through these scenarios with stakeholders. We extracted the knowledge when it was still cheap to change things.
Catching Disasters Early
Those questions - āwhat if the seat is already in use?ā - those are disasters when you tackle them later. They might change the whole process. And if youāve already written code, if youāve already deployed to production, the cost of that change becomes catastrophic.
Event modeling catches these problems before a single line of code is written.
Thatās where the real value lives. Not in the elegance of the technical solution, but in spotting the gaps early - when theyāre still just sticky notes on a board instead of emergency patches at 2am.
Process Before Provider
If youāre building a payment system, hereās my advice:
Understand YOUR process first. Then understand how to map that to Stripe.
Donāt let the third-party API dictate your domain model. The integration should be a translation layer, not your core logic. When you get this right, switching providers becomes trivial. Your domain stays stable. Only the adapter changes.
Boring is Beautiful
When people ask me which slice Iām most proud of, I tell them the truth: thereās absolutely nothing special about any of them. Theyāre straightforward.
And maybe that is the thing to be proud of.
Payment integrations are usually nightmares. Theyāre the thing developers dread. The thing that causes production bugs. The thing that takes three times longer than estimated.
Ours just works.
No heroics. No firefighting. No technical debt weāre planning to āfix later.ā Just boring, reliable infrastructure doing exactly what itās supposed to do.
The Hard Part
For me, event modeling first has become second nature. But for most developers, itās a hard pill to swallow. It requires a real mindset shift.
Thereās always that voice saying āletās just start coding and figure it out as we go.ā The urge to skip the boring, unglamorous work of modeling and jump straight into implementation.
It takes discipline to resist that. To sit with stakeholders and map out processes. To play through failure scenarios. To think deeply about edge cases before they become production incidents.
But that discipline - thatās what makes the implementation straightforward.
The Takeaway
When you understand your process deeply - when you model the happy paths AND the failures, when you think through edge cases with stakeholders, when you design your domain independent of your tools - the implementation becomes almost trivial.
Ten slices. Straightforward. Boring.
And thatās exactly how critical infrastructure should be.
Want to Build Systems Like This?
Want to learn how to build those systems for real? Grab on of the last seats in my upcoming Event Sourcing And Slicing Foundations Workshop - Building a real system Slice by Slice.
As a Newsletter Subscriber, youāll get the additional Event Modeling Foundations Workshop for free - on January 19, we model what weāll implement on January 20 and 21. Just answer āIām inā to this E-Mail and Iāll send you some details.
Join the Agentic Engineer Program
Apply Spec-Driven Development Hands-On - Event Modeling, Event Sourcing, and AI Engineering with autonomous agents.
Book a Call Today
Want to talk through how Event Modeling could work for your team or project? Letās have a quick, no-pressure conversation.
