DataData ModelSections
Data Model
Design notes from each story. Tables belong to the owning service only.
- PAYMENT-V2-E13-01 · Stripe Customer per user
payment.customers(owner_id primary key, stripe_customer_id unique, created_at). The Stripe customer lives in Payment's schema, not on Identity's user.- PAYMENT-V2-E13-02 · Save a card
payment.payment_methods(id, owner_id, stripe_payment_method_id unique, brand, last4, exp_month, exp_year, is_default, created_at). No card number or CVC is ever stored.- PAYMENT-V2-E13-03 · Manage payment methods
- Partial unique index on
payment.payment_methods(owner_id)where is_default allows one default per user. - PAYMENT-V2-E13-04 · One-tap pay with default card
payment.payments(id, owner_id, app, reference, description, stripe_payment_intent_id unique, payment_method_id, amount, currency, statusrequires_action|processing|succeeded|failed|refunded, receipt_url, created_at). MVP1payment.ordersremain for Checkout.docflow.batchesadds payment_id.- PAYMENT-V2-E13-05 · Payment history
- No schema change; index
payment.payments(owner_id, created_at desc). - PAYMENT-V2-E13-06 · Free plan and upgrade to paid
payment.subscriptions(id, owner_id unique, plan, statusactive|past_due|cancelled, stripe_subscription_id unique, current_period_end, created_at).identity.usersaddsplan, kept in step from the event.- PAYMENT-V2-E13-07 · Scheduled payments
payment.schedules(id, owner_id, app, reference, description, amount, currency, payment_method_id, charge_on date, time_zone, statusscheduled|processing|charged|requires_action|failed|cancelled, payment_id → payments, attempts, reminded_at, created_at, cancelled_at). A partial unique index allows one open schedule per app and reference. A daily job picks schedules due today (in their time zone) withfor update skip locked, so two runs never charge the same schedule.
Coming Soon...
The entities, their relationships, what every field means and the business rules will appear here when this module's design is finalized.