Wraith. Billing behaviour
(Wraith v0.1.0)
View Source
Paid memberships through Stripe Checkout, with Req against the Stripe
API (no SDK). Settings hold stripe_secret_key, stripe_webhook_secret
and stripe_price_id (a recurring price); configured?/0 is false until
all three are set, and then:
checkout_url/3— a Checkout Session in subscription mode for the member (the Stripe customer is created on first use and remembered)handle_webhook/2— verifiesStripe-Signature(HMAC-SHA256, 5 min tolerance) and syncs the member:checkout.session.completedandcustomer.subscription.updated(active/trialing) →paid;customer.subscription.deleted/ unpaid →free
Billing.API (internal) is the HTTP seam (swapped for a fake in tests).
Summary
Functions
Where to send a member to pay.
Verify and apply a webhook. Returns {:ok, event_type} | {:error, reason}.
A Stripe customer-portal session: the member manages card and subscription there.
Build a signed header the way Stripe does (tests, and the docs' sanity check).
Callbacks
Functions
Where to send a member to pay.
Verify and apply a webhook. Returns {:ok, event_type} | {:error, reason}.
A Stripe customer-portal session: the member manages card and subscription there.
Build a signed header the way Stripe does (tests, and the docs' sanity check).