Subscriptions & proration

Run tiered subscriptions with 0% ExaSpark platform fee — including mid-cycle upgrades, proration rules, self-serve cancellations, and failed-payment recovery.

How recurring billing and 0% ExaSpark fees work

Every recurring app built on ExaSpark connects directly to your own Stripe account. ExaSpark charges a 0% platform fee on every monthly renewal, annual upgrade, and seat expansion — standard Stripe card processing fees still apply, and settled revenue transfers straight from Stripe to your bank.

Stripe owns payment methods, invoices, and renewal timers. Your ExaSpark Cloud database stores a clean subscriptions projection updated strictly via cryptographically signed Stripe webhooks.

Checking that local table on every server request keeps feature gating fast and never stalls on external billing API calls.

Designing multi-tier and seat-based pricing

Choose a pricing model aligned with customer value, and map every Stripe Price ID explicitly to an internal plan code on your backend.

PatternBest fit forMechanicsExample
Flat tiersSolo SaaS tools, member portalsFixed monthly/annual fee unlocking quotasFree ($0), Starter ($19/mo), Pro ($49/mo)
Annual toggleStronger cash flow and retentionAnnual price offers ~2 months free$19/month or $180/year
Seat billingB2B client portals, agenciesPer-seat price multiplied by workspace quantity$12/seat/month (min 3 seats)

Never infer a user's tier from raw dollar strings or browser parameters. Keep one authoritative server-side lookup map from Stripe price_id to plan limits:

json
{
  "price_live_starter_mo": { "plan": "starter", "interval": "month", "max_projects": 10, "csv_export": false },
  "price_live_starter_yr": { "plan": "starter", "interval": "year",  "max_projects": 10, "csv_export": false },
  "price_live_pro_mo":     { "plan": "pro",     "interval": "month", "max_projects": 100, "csv_export": true },
  "price_live_pro_yr":     { "plan": "pro",     "interval": "year",  "max_projects": 100, "csv_export": true }
}

Keep Test and Live Price IDs separate via environment settings so Preview always runs against Stripe Test mode. See Preview vs Live isolation.

Upgrades, downgrades, and how proration works

Subscribers upgrade mid-cycle the moment they hit a quota. Proration calculates unused credit from the old plan against remaining time on the new plan.

If a $19/month Starter subscriber upgrades to $49/month Pro halfway through a 30-day cycle:

  • Unused Starter credit: -$9.50 (15 days left)
  • Remaining Pro cost: +$24.50 (15 days left)
  • Net charge: $15.00 for the current cycle, then $49.00 on next renewal.
`proration_behavior`How Stripe billsRecommended use
`always_invoice`Charges net proration immediatelyUpgrades — clears payment before instant unlock
`create_prorations`Batches credits/debits onto next invoiceSeat edits — avoids tiny repeated charges
`none` (period end)Switches at current_period_end with no mid-cycle refundDowngrades — lets users finish paid time

Handling downgrades without deleting user data

Never delete a subscriber's projects or records when they downgrade. If a Pro user with 18 projects drops to Starter (limit 10), keep all 18 readable, show a calm limit notice (18 / 10), and block creating a new project until they archive down or upgrade.

Switching between monthly and annual cycles

When a monthly subscriber switches to an annual plan inside the Customer Portal, Stripe starts a new 12-month cycle immediately, credits their unused monthly days toward the annual invoice, and sends customer.subscription.updated with the annual price_id and updated current_period_end.

Always allow seamless monthly-to-annual upgrades while scheduling annual-to-monthly downgrades for current_period_end. That policy prevents unexpected partial annual refunds and keeps cash flow predictable while honoring every day already paid.

Self-serve billing with the Stripe Customer Portal

Manual card swaps, invoice requests, and cancellation emails waste founder time and trigger avoidable disputes. Route a single Manage billing button straight to Stripe's hosted Customer Portal.

  1. Configure Portal rules in Stripe

    Enable card updates, invoice downloads, allowed plan switches, and cancel-at-period-end in Stripe → Billing → Customer portal.

  2. Block duplicate subscriptions

    Before creating a new Checkout Session, check subscriptions. Route already-active subscribers to the Customer Portal instead.

  3. Build an authenticated portal route

    Look up users.stripe_customer_id from the server session and return a short-lived portal session pointing back to /settings/billing.

  4. Sync changes via webhooks

    Update plan_code, status, current_period_end, and cancel_at_period_end whenever customer.subscription.updated or customer.subscription.deleted arrives.

  5. Verify every flow in Preview

    Upgrade, downgrade, cancel, and reactivate in Stripe Test mode while confirming Cloud table state.

Recovering failed renewals (dunning and grace periods)

Even loyal subscribers hit failed renewals from expired cards or bank fraud filters. Handling past_due calmly preserves recurring revenue.

Keeping access calm during Smart Retries

Enable Stripe Smart Retries so Stripe automatically retries failed renewals over several days. When invoice.payment_failed arrives, set status = 'past_due' instead of locking users out immediately.

Show a slim account banner ("Renewal failed — update your card to keep Pro active") linking to the Customer Portal, and send one branded alert via Transactional email flows.

  • Retry succeeds: invoice.paid flips status back to active and clears the banner.
  • Retries exhaust: customer.subscription.deleted cleanly downgrades the account to canceled.

Cancel at period end vs immediate cancellation

When a subscriber cancels in the Customer Portal, Stripe sets cancel_at_period_end = true while keeping status = 'active' through current_period_end. Display the exact end date and keep Pro unlocked until customer.subscription.deleted fires.

Starter prompt · App

Build multi-tier Stripe subscriptions: Free ($0, 3 projects), Starter ($19/mo or $180/yr, 10 projects), and Pro ($49/mo or $480/yr, unlimited projects and CSV exports). Map Stripe `price_id` values server-side, route active subscribers to Stripe Customer Portal instead of creating duplicate Checkouts, and handle `checkout.session.completed`, `invoice.paid`, `invoice.payment_failed`, `customer.subscription.updated`, and `customer.subscription.deleted` idempotently. Keep `past_due` access open with a slim update-card banner, display the exact end date when `cancel_at_period_end` is true, and keep existing projects readable on downgrade while blocking new creation above the lower limit.

Troubleshooting subscription and proration edge cases

SymptomMost likely root causeReliable fix
Portal upgrade stayed lockedWebhook missed customer.subscription.updated or price_id mapMap all monthly/annual price_id values and update plan_code on update
User billed on two active plansUpgrade button launched fresh Checkout instead of PortalCheck active subscriptions server-side and redirect to Customer Portal
Lost access right after cancelUI treated cancel_at_period_end as immediate revokeGrant access while status IN ('trialing', 'active'); revoke on canceled
Seat edits fired tiny chargesQuantity updates used always_invoice on every seat addUse create_prorations so seat deltas batch onto the next invoice
Live checkout hit `No such price`Test mode price_... IDs left in Live configCreate Live products/prices in Stripe Live Dashboard and update Live IDs

Next steps

Still have a question?Ask our team and other builders on Discord.

From the blog