Billing Providers — Setup Guides
Hướng dẫn vận hành (operations) để cấu hình các billing provider cho SaaS subscription của platform. Đây là tài liệu *thao tác trên dashboard nhà cung cấp
- super-admin UI* — không phải tài liệu kiến trúc.
Kiến trúc / quyết định thiết kế xem ở:
../../architecture/subscription-architecture.md— bounded context, port/adapter, aggregate.../../architecture/polar-integration-plan.md— kế hoạch migration LemonSqueezy → Polar, trạng thái từng phase.
Bối cảnh
Subscription context provider-agnostic: domain chỉ phụ thuộc
BillingProviderPort. Provider nào "live" do dòng PlatformBillingConfig
đang Active quyết định — không phải env var. Super-admin tự nhập credentials
(mã hoá AES-256-GCM at rest) tại /admin/superadmin/settings?tab=billing.
Đổi provider = tạo config mới + Activate. Không cần deploy.
Provider hiện có
| Provider | Trạng thái | Guide |
|---|---|---|
| Polar.sh | 🚧 MVP (sandbox) | polar-setup.md |
| LemonSqueezy | Code còn, UI ẩn (legacy) | — |
| Stripe / Paddle | Adapter stub | — |
Quy tắc bảo mật (đọc trước)
- KHÔNG paste Access Token / Webhook secret vào chat, commit, hay Slack. Chỉ nhập trực tiếp vào super-admin UI (field mã hoá).
- Token hiện một lần duy nhất khi tạo — copy ngay, lưu password manager.
- Sandbox và Production là 2 token + 2 webhook secret riêng. Đừng trộn.