Subscription Service Development: Billing, Retention, Dunning
Many SaaS projects lose up to 30% of revenue due to unprocessed failed payments. A typical scenario: after registration, a user enters a card, goes through a trial, but a month later the payment fails — the card has expired or insufficient funds. Without dunning, the client leaves, even though they could have stayed. In this article, we will break down how to build reliable billing on Stripe Billing: from trial setup to retention mechanics that bring clients back. We will cover specific scenarios: handling past_due, configuring Smart Retries, integrating the Customer Portal, and centralized access checks. Each of these elements can reduce churn by 20–30%. Mistakes at these stages — incorrect webhook configuration, missing idempotency keys — lead to duplicate payments or missed events. We have accumulated experience from over 50 projects and are ready to share proven solutions. Our team of certified Stripe developers guarantees reliable billing architecture.
How Is the Subscription Lifecycle Structured?
Every subscription goes through states: trialing → active → past_due → cancelled or active → cancelled (by user action). The payment provider's webhooks notify the application of each transition. It is crucial to handle three key events:
-
invoice.payment_succeeded— activate the subscription, reset trial_end. -
invoice.payment_failed— set status topast_due, start dunning (retry attempts). -
customer.subscription.deleted— immediately deactivate access to paid features.
Missing even one webhook means the client retains access without payment.
What Is Dunning and How Does It Reduce Churn?
Dunning is an automated process of retrying failed payments. According to Stripe documentation, Smart Retries uses machine learning to choose the optimal time for each retry: up to 4 times within 14 days. Configuration in the Stripe dashboard:
- Set the maximum number of attempts (recommended 3–4).
- Specify the interval between attempts (daily or every other day).
- Enable the
invoice.payment_failedwebhook to send email notifications.
Parallel to this, the Stripe Customer Portal allows the client to update their payment method without your involvement. Smart Retries recovers up to 90% of failed payments — three times more effective than manual retries.
| Parameter | Stripe Smart Retries | Manual Retries |
|---|---|---|
| Attempts | up to 4 | any number, no ML |
| Timing | ML chooses | fixed interval |
| Email notifications | via Portal | custom implementation |
| Payment recovery | up to 90% | ~30% |
Free Trial Period: With or Without Card?
| Parameter | Trial without card | Trial with card |
|---|---|---|
| Registration friction | Low | High |
| Conversion to paying | Lower (~50%) | Higher (~80%) |
| Fraud risk | Higher | Lower |
| Recommendation | B2C, viral products | B2B SaaS |
Thus, trial with card is 1.6 times more effective for conversion (80% vs 50%). For B2B SaaS, trial with card is recommended. For B2C and viral products, trial without card.
Upgrade/Downgrade: Instant Plan Change
Plan changes should be instant and account for the already paid period. Stripe handles this via proration:
await stripe.subscriptions.update(subscriptionId, { items: [{ id: itemId, price: 'price_premium_monthly' }], proration_behavior: 'create_prorations', }); On upgrade, the difference for the remaining days of the period is charged. On downgrade, the difference is credited.
Which Retention Mechanics Actually Work?
- Cancellation flow: instead of a "Cancel" button — a dialog with clarifying questions ("Why are you leaving?"), offering a pause (1–3 months) or a discount.
- Email campaigns: a series of emails on past_due, at trial end without conversion, after 30/60/90 days post-cancellation.
- Win-back offers: special offers for canceled users.
These mechanics recover up to 20% of canceled subscriptions. For example, at a churn of 5% and ARPU of $200, proper dunning configuration can recover up to $9,000 per month.
Typical Mistakes in Subscription Integration
- Unhandled past_due — webhooks for failed payments not configured, client is lost.
- Missing proration — no proportional credit on plan change, billing out of sync.
- Scattered access checks — instead of a centralized Gate, checks are spread across controllers.
- Ignoring webhook idempotency — duplicate notifications from Stripe can cause double activation.
What Is Included in the Work on a Subscription Service?
The final project includes:
- Documentation on billing architecture and API.
- Access to the Stripe account and test cards.
- Training your team on billing operations.
- Support for 30 days after launch.
Work Process
- Requirements analysis and tariff grid design
- Stripe Billing integration (webhooks, portal, proration)
- Implementation of registration, trial, upgrade/downgrade, dunning
- Retention mechanics (cancellation flow, email campaigns)
- API and architecture documentation
- Testing of payment flow and cancellation scenarios
- Support and refinements after launch
- Training your team on billing operations
Timelines and Cost
A web service with subscription via Stripe (registration, trial, upgrade/downgrade, portal, basic webhooks): from 2 to 3 months. With extended tariffs, teams, dunning, and analytics: from 3 to 5 months. Cost is calculated individually based on complexity and required stack.
Order development of reliable subscription billing — from tariff design to retention mechanics. Get a consultation for your project.







