8 lines
1.2 KiB
Markdown
8 lines
1.2 KiB
Markdown
# Charge-saved-method port, own subscription brain
|
|
|
|
Two payment providers must support recurring subscription renewals (YooKassa RUB, bePaid BYN), each with incompatible native recurring models (YooKassa `save_payment_method` + charge by payment id; bePaid card tokens). Rather than delegating subscription lifecycle to provider-native subscription engines (e.g. Stripe Billing style), we keep the existing worker-billing scheduler as the single subscription brain and extend the `PaymentProvider` port with one primitive: `charge_saved_method(token, amount, currency, …)`. Each adapter maps it to its provider's saved-card mechanism. This keeps renewal scheduling, dunning (day 1/3/7 retries), period anchoring and refund policy provider-agnostic, and lets a future provider (e.g. Stripe) slot in behind the same port without migrating subscription state.
|
|
|
|
## Consequences
|
|
|
|
- Saved Payment Methods are provider- and currency-bound; they can never be reused across providers or currencies (see ADR-0002).
|
|
- ЕРИП payments (bePaid bank rails) cannot save a method: ЕРИП-origin subscriptions are forced `auto_renew = FALSE` and renew manually via bot/email instructions.
|