stripe-billing

Implement Stripe Billing for subscriptions, recurring payments, invoicing, and usage-based pricing. Use when: (1) Creating subscription plans (flat, tiered, per-seat, usage-based), (2) Managing subscription lifecycle (trials, upgrades, downgrades, cancellations), (3) Generating and customizing invoices, (4) Implementing metered/usage-based billing, (5) Setting up customer portal for self-service, (6) Configuring dunning and revenue recovery, (7) Applying coupons and promotion codes. Triggers on: subscription, recurring billing, invoice, usage-based, metered billing, SaaS pricing, subscription plan, trial, dunning, proration, customer portal, coupon, promotion code, billing cycle.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "stripe-billing" with this command: npx skills add zef-computers/drivers/zef-computers-drivers-stripe-billing

Stripe Billing

Implement subscriptions, invoicing, and flexible pricing models for recurring revenue.

Rule Priority

PriorityRuleImpactDescription
1sub-use-checkout-for-creationHIGHCreate subscriptions via Checkout for built-in payment collection, SCA, and tax
2sub-check-payment-behaviorHIGHUse default_incomplete for SCA-compliant API-created subscriptions
3sub-expand-latest-invoiceHIGHExpand latest_invoice.payment_intent to get client secret in one call
4webhook-verify-signaturesHIGHAlways verify webhook signatures to prevent forged events
5webhook-handle-subscription-updatedHIGHSync state on every subscription.updated for plan changes, cancellations, status
6invoice-listen-paid-eventHIGHUse invoice.paid (not payment_intent.succeeded) for subscription fulfillment
7webhook-idempotent-handlersHIGHDesign handlers for at-least-once delivery with event deduplication
8webhook-return-200-quicklyHIGHAcknowledge webhooks immediately, process asynchronously
9price-use-lookup-keysHIGHUse lookup_key for price references instead of hardcoded IDs
10dunning-enable-smart-retriesHIGHEnable ML-powered Smart Retries for optimal payment recovery
11sub-cancel-at-period-endHIGHCancel at period end for better UX and win-back opportunity
12trial-collect-payment-methodHIGHCollect payment method during trial for higher conversion
13usage-report-idempotentlyHIGHInclude idempotency keys with usage records to prevent double-counting
14usage-flush-before-period-endHIGHFlush usage buffers before period end to prevent revenue leakage
15portal-configure-allowed-productsHIGHExplicitly list products/prices in portal configuration
16price-use-decimal-for-subcentHIGHUse unit_amount_decimal for sub-cent pricing
17invoice-preview-before-changesMEDIUMPreview upcoming invoice before applying subscription changes
18trial-handle-will-end-webhookMEDIUMHandle trial_will_end for pre-expiry reminders
19usage-prefer-billing-metersMEDIUMUse Billing Meters over legacy usage records for new integrations
20portal-use-deep-linksMEDIUMUse flow_data for targeted portal actions
21sub-pause-not-cancelMEDIUMPause subscriptions instead of canceling for temporary stops
22dunning-escalate-communicationsMEDIUMEscalate dunning communications over retry attempts
23price-deactivate-not-deleteMEDIUMDeactivate old prices instead of deleting them

Pricing Model Decision Tree

What pricing model fits your product?
|
+-- Fixed monthly/annual fee?
|   -> Flat-rate pricing (references/pricing-models.md)
|
+-- Per-seat / per-unit?
|   -> Per-unit pricing (references/pricing-models.md)
|
+-- Volume tiers (price decreases with quantity)?
|   -> Tiered pricing (references/pricing-models.md)
|
+-- Pay for what you use (API calls, storage)?
|   -> Usage-based / metered (references/usage-based.md)
|
+-- Hybrid (base fee + usage)?
    -> Multiple prices on one subscription (references/pricing-models.md)

Quick Start: SaaS Subscription

1. Create Product + Price (once, or via Dashboard)

const product = await stripe.products.create({
  name: 'Pro Plan',
  description: 'Full access to all features',
});

const price = await stripe.prices.create({
  product: product.id,
  unit_amount: 2900, // $29/month
  currency: 'usd',
  recurring: { interval: 'month' },
  lookup_key: 'pro_monthly',
});

2. Create Subscription via Checkout

const session = await stripe.checkout.sessions.create({
  customer: 'cus_xxx', // or let Checkout create one
  line_items: [{ price: price.id, quantity: 1 }],
  mode: 'subscription',
  success_url: 'https://example.com/success?session_id={CHECKOUT_SESSION_ID}',
  cancel_url: 'https://example.com/cancel',
});

3. Or Create Subscription Directly (with existing payment method)

const subscription = await stripe.subscriptions.create({
  customer: 'cus_xxx',
  items: [{ price: price.id }],
  default_payment_method: 'pm_xxx',
  payment_behavior: 'default_incomplete', // requires client confirmation
  expand: ['latest_invoice.payment_intent'],
});
// Return subscription.latest_invoice.payment_intent.client_secret to frontend

Subscription Lifecycle

incomplete -> active -> past_due -> canceled
                     -> canceled (immediate)
                     -> paused
trialing -> active (payment succeeds)
        -> incomplete (payment fails)
        -> canceled (trial ends, no payment method)

Customer Portal (Self-Service)

// One-time setup in Dashboard or API
const configuration = await stripe.billingPortal.configurations.create({
  features: {
    subscription_update: { enabled: true, products: [{ product: 'prod_xxx', prices: ['price_basic', 'price_pro'] }] },
    subscription_cancel: { enabled: true, mode: 'at_period_end' },
    payment_method_update: { enabled: true },
    invoice_history: { enabled: true },
  },
});

// Generate portal session per customer
const portalSession = await stripe.billingPortal.sessions.create({
  customer: 'cus_xxx',
  return_url: 'https://example.com/account',
});
// Redirect to portalSession.url

Critical Webhooks

EventAction
customer.subscription.createdProvision access
customer.subscription.updatedHandle plan changes, cancellation scheduling, status transitions
customer.subscription.deletedRevoke access
customer.subscription.trial_will_endRemind user (3 days before)
invoice.paidConfirm payment, extend access
invoice.payment_failedNotify user, trigger dunning escalation
invoice.upcomingPreview next charge

Quick Reference

TopicKey ConceptReference
Flat/tiered pricingProducts have multiple Prices; use lookup_keyreferences/pricing-models.md
Subscription creationPrefer Checkout; use default_incomplete for APIreferences/subscription-lifecycle.md
Usage billingBilling Meters (modern) or Usage Records (legacy)references/usage-based.md
Trialstrial_period_days or trial_end; collect payment methodreferences/trials.md
Invoicesinvoice.paid is authoritative; preview before changesreferences/invoices.md
Customer portalConfigure products explicitly; use deep linksreferences/customer-portal.md
DunningSmart Retries + escalating communicationsreferences/dunning.md
CouponsCoupons (internal) + Promotion Codes (customer-facing)references/coupons.md
Prorationalways_invoice for immediate; none for period-endreferences/proration.md
SchedulesPhase-based automation; max 10 phasesreferences/schedules.md

References

  • references/pricing-models.md - Flat, tiered, per-unit, graduated, volume pricing
  • references/subscription-lifecycle.md - Create, update, cancel, pause, resume
  • references/usage-based.md - Metered billing, usage records, aggregation
  • references/trials.md - Free trials with/without payment method, trial conversions
  • references/invoices.md - Invoice generation, customization, hosted page
  • references/customer-portal.md - Self-service configuration and customization
  • references/dunning.md - Smart retries, failed payment emails, recovery
  • references/coupons.md - Coupons, promotion codes, discounts
  • references/proration.md - Mid-cycle upgrades/downgrades, proration behavior
  • references/schedules.md - Subscription schedules for future changes

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

stripe-dev

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

tauri-dev

No summary provided by upstream source.

Repository SourceNeeds Review
General

stripe-connect

No summary provided by upstream source.

Repository SourceNeeds Review
General

stripe-payments

No summary provided by upstream source.

Repository SourceNeeds Review