● Bubble Architect Series · Stripe Billing Architecture

How We Architect Stripe Billing in Bubble: Our Exact Pattern

Stripe billing is the most consequential technical decision in any SaaS. Get it wrong and billing state drifts from reality. Here is our exact pattern: the data model, all six webhook events, and the rule that cannot be broken — webhooks are the only source of truth.

WebhooksONLY Source of Truth
6Events Always Handled
NeverRedirect URL = Status
Billing Architecture

The Stripe Integration Most Developers Get Wrong — And How We Do It

Stripe billing is the most consequential technical decision in any SaaS product. Get it wrong and customers who paid have no access, customers who cancelled retain access, and the billing state drifts from reality whenever the network is unreliable or a browser is closed too soon. Get it right and billing is silent infrastructure that simply works. Here is the exact pattern we implement on every project.

The Core Principle

Webhooks Are the Only Source of Truth

The rule that cannot be broken: Subscription status is updated only by Stripe webhook events. Never by redirect URLs. Never by frontend workflow actions. Never by user-submitted data. When a customer completes a checkout, the success page shows a confirmation message. The subscription activation happens only when the checkout.session.completed webhook is received and validated server-side. This is the single most important billing architecture decision in any Bubble SaaS.
Data Model

How We Model Billing State on the Workspace

// Workspace billing fields
subscription_status
→ option set (Trialing, Active, Past_Due, Cancelled, Paused)
plan
→ Plan data type
stripe_customer_id
→ text (set on workspace creation)
stripe_sub_id
→ text (set on checkout.completed webhook)
trial_starts_at
→ date
trial_ends_at
→ date
current_period_end
→ date (updated each invoice.payment_succeeded)
seats_used
→ number (denormalised, updated on member add/remove)

// Plan data type (one record per pricing tier)
Plan

name
→ text (‘Starter’, ‘Growth’, ‘Scale’)
stripe_price_mo
→ text (Stripe Price ID for monthly)
stripe_price_yr
→ text (Stripe Price ID for annual)
seat_limit
→ number (0 = unlimited)
record_limit
→ number (0 = unlimited)
trial_days
→ number
The Six Webhooks We Always Handle

Every Event, Every State Transition

Webhook EventWhat We DoWorkspace Update
checkout.session.completedValidate workspace_id from metadata; find Workspacestatus=Active, stripe_sub_id=event.subscription
customer.subscription.updatedHandle plan change, pause, or resumestatus and plan updated from event data
customer.subscription.deletedMark as cancelled; preserve all data; show reactivation UIstatus=Cancelled, cancelled_at=now
invoice.payment_failedMark as past due; urgent payment update bannerstatus=Past_Due, payment_failed_at=now
invoice.payment_succeededConfirm payment; update period end; clear past_due flagstatus=Active, current_period_end updated
customer.subscription.trial_will_endSchedule upgrade prompt email 3 days before trial endssend_trial_ending_email scheduled

Work With a Bubble Architect

Most developers build Bubble apps. We architect them. Data models designed for scale, multi-tenant security built from day one, Stripe billing that never fails, and workflows engineered for performance. This is what a Bubble Architect delivers.

Schedule an Architecture ReviewView Our Work

How We Architect Stripe Billing in Bubble: Our Exact Pattern
Simple Automation Solutions — Bubble Architects · sasolutionspk.com

Book a Free Idea Audit Call

Your idea is ready. Is your plan ready?

Book a free Idea Audit with Athar Ahmad - Certified Bubble.io Developer and Tech Architect.

In 30 minutes, you’ll know exactly what to build, how to build it and what it will cost.

More Details about the Audit Call

Simple Automation Solutions

Business Process Automation, Technology Consulting for Businesses, IT Solutions for Digital Transformation and Enterprise System Modernization, Web Applications Development, Mobile Applications Development, MVP Development