payments#
Stripe-based subscription management with a tier system (data, reader, premium), invoice generation, Lexoffice bookkeeping sync, guest subscriptions with access tokens, identity event tracking, and webhook idempotency.
Models#
Model |
Description |
|---|---|
|
Tier definitions with dual Stripe price IDs (test/live) and feature flags |
|
Generated PDF invoices with email sending + Lexoffice upload tracking |
|
Stripe customer → Django user one-to-one link |
|
Active or historical Stripe subscription for a registered user |
|
Subscription for non-registered users (email + access token) |
|
Idempotency log preventing duplicate webhook processing |
|
Audit log for auth events (login, signup, email claim, etc.) |
URL Routes#
Path |
View |
Description |
|---|---|---|
|
|
Returns Stripe publishable key |
|
|
Legacy subscription checkout |
|
|
Stripe webhook receiver |
|
|
Post-checkout success page |
|
|
Cancellation page |
|
portal redirect |
Redirect to Stripe billing portal |
|
|
GET available tiers with pricing |
|
|
POST create tier checkout session |
|
|
Manage subscription (token or auth) |
Management Commands#
Command |
Description |
|---|---|
|
Link guest purchases/subscriptions to users by matching email |
|
Report on identity system events and counts |
Subscription Tiers#
Webhook Flow#
Key Design Decisions#
Dual Stripe price IDs (
stripe_price_id_test/stripe_price_id_live) onSubscriptionTierallow seamless switching between Stripe test and live mode via a settings flag.Guest subscriptions use email +
access_tokenfor access without requiring registration.StripeCheckoutEvent provides webhook idempotency — every event is checked by
event_idbefore processing to prevent duplicate invoice generation.IdentityEvent is append-only, capturing the full identity lifecycle (signup → email claim → account link → login).
Webhook URL is mounted outside
i18n_patternsat a fixed path so Stripe can always reach it regardless of language prefix.