What problem does it solve? Building Stripe billing from scratch involves many failure-prone details: proration math, webhook idempotency, trial abuse prevention, and subscription state synchronization. This Skill provides tested patterns for the full subscription lifecycle so you avoid double-processing webhooks, proration surprises, and broken upgrade/downgrade flows. ## Core Features & Use Cases - Subscription Lifecycle Management: Create, upgrade, downgrade, cancel, and pause subscriptions with correct proration behavior and a documented state machine (trialing, active, past_due, canceled, and more). - Idempotent Webhook Handlers: Signature-verified webhook processing with an event-deduplication table covering checkout.session.completed, subscription updates, and invoice payment success/failure. - Checkout, Portal, and Usage Billing: Ready-to-adapt Next.js route handlers for checkout sessions, customer portal sessions, metered usage reporting, and proration previews. - Use Case: You are adding paid plans to a Next.js SaaS app. Use this Skill to scaffold the checkout route, webhook handler, plan-change logic with proration preview, and feature-gating middleware, then test everything locally with the Stripe CLI. ## Quick Start Ask the assistant to implement a Stripe subscription checkout flow with an idempotent webhook handler for your Next.js app using this Skill.