Expand description
Stripe billing primitives.
This plugin is intentionally small. It does NOT make HTTP calls to Stripe — apps drive the API from TypeScript functions where they already have a networking story. What this module does provide is the security-critical and easy-to-mess-up bits:
- Webhook signature verification (
verify_signature) — Stripe rejects a webhook if you don’t validate theStripe-Signatureheader against your endpoint secret. Getting the HMAC + timestamp comparison right is subtle (constant-time compare, replay window). This implementation matches Stripe’s published reference algorithm. - Event payload typing (
StripeEvent) — a tiny shape over what arrives from a webhook, so app code can match onevent.typewithout re-parsing raw JSON. - Customer lookup state (
StripeCustomerStore) — an optional in-memory map from app user id → Stripe customer id, useful in dev. Production apps store this in their own user table.
See https://stripe.com/docs/webhooks/signatures for the algorithm spec.
Structs§
- Stripe
Customer Store - In-memory mapping from app user id → Stripe customer id.
- Stripe
Event - Minimal projection of a Stripe webhook event.
- Stripe
Plugin - Aggregate plugin so apps can register the whole Stripe surface at once.
Enums§
Functions§
- current_
unix_ secs - verify_
signature - Verify a Stripe webhook signature.