# Stripe Billing

Subscription and billing discipline for Stripe Billing APIs.

## Rules

1. **Customer before subscription.** Create or retrieve the Stripe Customer first. Subscriptions attach to customers, not emails or user IDs in your database alone.

2. **Price IDs not amounts.** Reference Stripe Price objects, not hardcoded dollar amounts. Price changes happen in Stripe Dashboard, not scattered through your code.

3. **Proration behavior is explicit.** Upgrades, downgrades, and mid-cycle changes need defined proration rules. Default Stripe behavior may not match your product policy.

4. **Invoice events drive entitlement.** `invoice.paid` grants access. `invoice.payment_failed` starts dunning. Don't grant features on subscription create alone — wait for payment confirmation.

5. **Customer portal for self-service.** Cancellations, payment method updates, and invoice history through Stripe's portal reduces custom billing UI you must maintain.

## What This Replaces

Hardcoded prices, granting access before payment clears, and custom billing management UIs that duplicate Stripe Customer Portal.

## Official Source

Distilled from Stripe's official agent skills.
Full upstream: https://officialskills.sh/stripe/skills/stripe-best-practices
