// the find
stripe-samples/subscription-use-cases
Create subscriptions with fixed prices or usage based billing.
Official Stripe sample showing how to wire up subscription billing — both fixed-price tiers and usage-based metering — using Stripe Billing and Elements. Covers the full flow: customer creation, plan selection, payment collection, plan upgrades/downgrades, and cancellation. Aimed at developers starting a Stripe Billing integration who want working reference code rather than reading docs cold.
Polyglot server implementations (Node, Python, Go, Ruby, Java, .NET, PHP, Next.js) mean you can read the pattern in whatever language you're actually using. The fixed-price flow covers the full subscription lifecycle including upgrade/downgrade with proration preview, which is the part most tutorials skip. Webhook handler is included and wired up — not an afterthought. The usage-based section was updated to use the newer Stripe Meters API rather than the deprecated metered billing approach, so you won't build on something that's already being sunsetted.
Each server language is a standalone minimal app with no tests beyond the Ruby Capybara e2e specs — the Go, Python, and PHP implementations have zero test coverage, so there's no confidence they're production-equivalent. The multi-language structure means any bug fix needs to be applied 8 times, and in practice they drift; the dotnet fixed-price server still uses the old Startup.cs/Program.cs split instead of minimal APIs. There's no error handling for incomplete payment states (card declined mid-trial, SCA challenge abandoned) beyond the happy path — you'll need to figure out the `payment_intent.requires_action` / `invoice.payment_failed` webhook logic yourself. The usage-based-subscriptions-legacy directory is just left there with no clear deprecation notice pointing you to the new meters-based version.