read.markets/app/routers
Giorgio Gilestro 78b2c2be28 stripe: collect billing address, handle paused subscriptions
Two pre-launch gaps.

1. Checkout collected no address, so Stripe Customers carried no
   country. EU B2C digital-services VAT is due at the consumer's place
   of supply and we can't even scope that question without knowing
   where buyers are; the card's billing country is the evidence a tax
   authority accepts, an IP guess is not. It also gives AVS data to the
   fraud checks. Passing `customer` suppresses the write-back to the
   Customer record, so existing customers also need
   customer_update.address=auto — without it the country lands on the
   PaymentIntent and nowhere durable.

2. A paused subscription kept paid features while Stripe billed
   nothing. Both mechanisms were unhandled: status="paused" (trial
   ended with no usable card) had no entry in _HANDLERS at all, and
   `pause_collection` — what the customer portal's pause button uses —
   leaves status as "active", so the status check waved it through.
   Revoke on both, keeping stripe_subscription_id since the
   subscription still exists at Stripe and resumes under the same id.

Pause is disabled in our live portal configuration, so (2) is latent
rather than live — but it's a one-toggle mistake away from being real.

Verified against live Stripe: a Checkout Session with the new params is
accepted (gbp 700, billing_address_collection=required, livemode), and
the live webhook endpoint already subscribes both paused and resumed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-30 12:13:47 +02:00
..
__init__.py initial commit — cassandra v0.1 2026-05-15 21:56:10 +01:00
api.py feedback: thumb up/down on logs + reviewer self-score 0-10 2026-05-29 21:28:03 +02:00
auth.py auth: affirmative versioned sign-up acknowledgement (EN + IT) 2026-05-29 20:50:38 +02:00
chat.py compliance: flag-gate AI portfolio + cloud sync + Stripe; de-risk prompts; harden reviewer 2026-05-29 19:57:12 +02:00
email.py css: split cassandra.css into per-section files 2026-05-28 12:31:29 +02:00
ops.py routers: extract chat + ops from api.py 2026-05-27 21:43:17 +02:00
pages.py feedback: thumb up/down on logs + reviewer self-score 0-10 2026-05-29 21:28:03 +02:00
polar_webhook.py stripe: per-cadence cooling-off + manage-subscription button 2026-05-26 20:06:19 +02:00
public.py compliance: flag-gate AI portfolio + cloud sync + Stripe; de-risk prompts; harden reviewer 2026-05-29 19:57:12 +02:00
stripe_billing.py stripe: collect billing address, handle paused subscriptions 2026-07-30 12:13:47 +02:00
sync.py compliance: flag-gate AI portfolio + cloud sync + Stripe; de-risk prompts; harden reviewer 2026-05-29 19:57:12 +02:00
ticker_validate.py ticker-validate: add /api/ticker/historical with weekend-walkback 2026-05-27 14:45:52 +02:00
universe.py compliance: flag-gate AI portfolio + cloud sync + Stripe; de-risk prompts; harden reviewer 2026-05-29 19:57:12 +02:00