Skip to content

Stripe Payment & Billing Architecture

This section documents the serverless, dynamic billing ecosystem connecting Stripe, Cloudflare KV, and BigQuery.


Architecture Highlights

  1. Universal Metadata Tagging: Every Customer, Checkout Session, Payment Intent, Subscription, and Invoice is stamped with pid, _id, user_id, and domain to enable real-time attribution and reporting.

  2. Zero-Maintenance Credit Top-Ups: Stripe Payment Links dynamically add instantCredits or weeklyCredits to user domains upon webhook receipt (checkout.session.completed) without requiring local cart state.

  3. Lightweight CMS Product Catalog: Stripe Payment Links and Price tiers act as the live product inventory. Targeted partner promotions are filtered via pid metadata rules (DLR,DDC,-ADD).

  4. Headless Billing & Customer Auto-Binding: Accounts created via API, Admin UI, or self-service registration automatically check Stripe for existing customers by email, bind their stripe_customer_id, and sync metadata tags.

  5. Dynamic Checkout Sessions: Checkout sessions created via payment.checkout.create cascade domain and partner metadata into underlying subscriptions and charges.


Documentation Guides