Subscription Service
The Subscription Service is the authority for subscription billing within the FloatMe platform. It owns the full subscription lifecycle — from activation and plan management through scheduled and event-driven collections, ACH payment processing, membership event handling, and pre-subscription notifications.
What This Service Owns
| Domain | Responsibility |
|---|---|
Subscriptions |
Subscription records and lifecycle — creation, activation, status transitions, upgrade, downgrade, reactivation, and ban |
Collections |
Automated scheduled and webhook-driven collection engine with retry logic, pause handling, ML-based collection decisions, and distributed locking |
Memberships |
Kinesis-driven membership lifecycle event processing — UPGRADE, DOWNGRADE, CANCEL, RETRACT, CLOSEACCOUNT, PAUSE, UNPAUSE, and related transitions |
Notifications |
Three-day pre-subscription notifier — daily scheduler queries upcoming subscribers and enqueues worker messages for Segment, Iterable, and push delivery |
ACH Callbacks |
Kinesis-driven ACH payment outcome processing — COMPLETED, RETURNED, REFUNDED, and CHARGED_BACK events from the payments stream mapped to billing status transitions |
Administration |
User bans from subscription eligibility, QA tooling for automated subscription creation, and admin notes via the Admin Service |
Events |
Billing activity events published to EventBridge and the |
Lambda Functions
| Function | Trigger | Purpose |
|---|---|---|
|
API Gateway (IAM + JWT) |
Primary REST API — subscription activation, reactivation, upgrade, downgrade, manual collection, billing history, billing details, active term, ban, and QA create |
|
Kinesis ( |
Processes membership lifecycle events from the user service and drives subscription state transitions for upgrades, downgrades, cancellations, pauses, and account closures |
|
Kinesis ( |
Processes ACH payment callbacks for subscription debits; maps COMPLETED, RETURNED, REFUNDED, and CHARGED_BACK outcomes to billing status; emits notifications via Segment, Iterable, and AppsFlyer |
|
DynamoDB Stream ( |
Reads DynamoDB Stream change records from |
|
SQS ( |
Handles bulk subscription operations and data management tasks dispatched to the batch queue |
|
CloudWatch scheduled rules (Mon–Fri) + SQS paging queues |
Queries DynamoDB for subscriptions due for collection and enqueues them to scheduled, retry, and pause collection queues; pages through results using SQS-backed pagination |
|
SQS ( |
Attempts subscription collection via the payments service; applies ML-based collection decisions; advances billing status and re-enqueues on retry and pause outcomes |
|
SQS ( |
Triggers opportunistic collection for subscriptions in a collectible state when an income transaction event exceeds the configured |
|
SQS ( |
Triggers opportunistic collection when a new account balance update event is received from the transaction service |
|
CloudWatch daily cron (12:00 UTC) + SQS paging queue |
Queries upcoming subscribers within the notification window and enqueues them to the notifier worker queue; pages through results via SQS |
|
SQS ( |
Sends pre-subscription notifications via Segment, Iterable, and push channels for users approaching their subscription billing date |
External Dependencies
| Service | Role |
|---|---|
Payments Service |
Executes subscription collection attempts (pinless debit and ACH) and ACH disbursements |
User Service |
User profiles and identity data consumed by the memberships Lambda and queried by the API and notifier |
Underwriting Service |
Validates subscription eligibility and plan availability during activation and upgrade flows |
Transactions Service |
Bank account balance data queried during webhook-triggered collection decisions |
Insight Service |
Source of income detection events (via EventBridge) that drive webhook-triggered collection |
Admin Service |
Internal admin tooling client used to attach notes to user accounts during subscription lifecycle events |
GrowthBook |
Feature flags controlling collection behavior, ACH routing, ML decider gating, and webhook collection eligibility |
SageMaker |
ML model endpoint backing the |
EventBridge |
Subscription billing event bus; income and balance event sources for webhook workers; scheduled rules for collections-job and notifier-scheduler |
Segment |
User analytics events for subscription activation, collection outcomes, ACH callbacks, and pre-subscription notifications |
Iterable |
Email and in-app notifications triggered by ACH payment events and pre-subscription notifier |
AppsFlyer |
Mobile attribution tracking for subscription activation and ACH payment events |
Documentation
-
Architecture — System context diagrams, Lambda functions, data storage, and integration overview
-
Infrastructure — Terraform layout, Lambda configuration, SQS queues, Kinesis streams, EventBridge rules, Secrets Manager, and monitoring
-
API Specification — Full OpenAPI spec (Swagger UI)
-
API Endpoints — Human-readable endpoint reference with request/response tables and error codes
-
Feature Summary — Categorized feature reference
-
DynamoDB Tables — Table schemas, access patterns, GSIs, and enumerated value references
-
Event Flows — Published events, scheduled rules, webhook event paths, and notifier flows
-
Subscription Lifecycle — Billing statuses, state transitions, activation, upgrade/downgrade, ban, and reactivation flows
-
Collections Engine — Scheduled, webhook income, webhook balance, and ACH settlement collection flows
-
ACH Processing — Kinesis ACH callback handling, status mapping, and notification emission
-
Memberships — Membership Kinesis consumer, event types, and state transitions
-
Notifications — Three-day pre-subscription notifier scheduler and worker
-
Collections: Processes — Collection process detail and decision flows
-
Collections: Architecture — Collections subsystem architecture
-
Collections: Module Architecture — Collections Go module structure