Update planning docs for processor-agnostic payment linking

Replace stripe_customer_id on account with account_processor_link
table. Update account_payment_method to use processor enum +
processor_payment_method_id instead of Stripe-specific fields.
Supports multiple simultaneous processors for migration scenarios.
This commit is contained in:
Ryan Moon
2026-03-27 17:45:00 -05:00
parent 5ff31ad782
commit 81894a5d23
2 changed files with 75 additions and 18 deletions

View File

@@ -94,11 +94,6 @@ jsonb
Street, city, state, zip
stripe_customer_id
varchar
Stripe customer reference
billing_mode
@@ -226,9 +221,9 @@ timestamptz
## 3.3 account_payment_method
## 3.3 account_processor_link
Tracks payment methods on file. The actual card data lives in Stripe — this table only stores references.
Links an account to a payment processor's customer record. This is processor-agnostic — supports Stripe, Global Payments, or any future processor. Replaces the previous `stripe_customer_id` column that was directly on the account table.
Column
@@ -248,17 +243,77 @@ uuid FK
company_id
uuid FK
Tenant scoping
processor
enum
stripe | legacy
stripe | global_payments
stripe_payment_method_id
processor_customer_id
varchar
pm_xxx reference
The processor's customer ID (e.g. cus_xxx for Stripe, GP customer token for Global Payments)
is_active
boolean
Allows deactivating without deleting
created_at
timestamptz
An account may have links to multiple processors simultaneously — this is expected during migration from one processor to another (e.g. AIM legacy → Stripe transition).
## 3.4 account_payment_method
Tracks payment methods on file. Card data lives in the processor — this table only stores references for display and selection.
Column
Type
Notes
id
uuid PK
account_id
uuid FK
company_id
uuid FK
Tenant scoping
processor
enum
stripe | global_payments
processor_payment_method_id
varchar
Processor's payment method reference (pm_xxx for Stripe, token for GP)
card_brand
@@ -294,7 +349,7 @@ requires_update
boolean
True if still on legacy processor
True if migrated from legacy processor and needs re-entry
created_at

View File

@@ -10,25 +10,27 @@ The Payments domain describes how the application integrates with Stripe for all
# 2. Stripe Entity Model
# 2. Processor Entity Model
Stripe Entity
Payment processor customer and payment method references are stored in processor-agnostic tables, not directly on the account. This supports running multiple processors simultaneously (e.g. during migration) and adding new processors without schema changes.
Processor Concept
Maps To
Notes
Customer
Customer (Stripe cus_xxx, GP customer token)
account
account_processor_link
One Stripe customer per billing account
One link per processor per account — multiple links allowed during migration
PaymentMethod
PaymentMethod (Stripe pm_xxx, GP payment token)
account_payment_method
pm_xxx stored as reference only
Processor-agnostic — `processor` enum + `processor_payment_method_id`
Subscription