"subscription_id": "sub_xyz789", "status": "active", "current_period_start": "2026-04-14T00:00:00Z", "current_period_end": "2026-05-14T00:00:00Z", "next_invoice": 25.00
| Stage | Description | |-------|-------------| | | Subscriber chooses a product/plan and provides necessary details (email, payment method, add-ons). | | 2. Validation | System checks: plan availability, payment method validity, duplicate subscriptions, compliance (e.g., age, region). | | 3. Payment Processing | If paid plan: charge initial fee (prorated or full). If trial: record trial start. | | 4. Subscription Creation | Generate unique subscription ID, store subscriber ID, plan ID, start date, next billing date, status (active/trial/pending). | | 5. Provisioning | Grant access rights, send welcome email/webhook, update CRM/analytics. | | 6. Acknowledgment | Return confirmation (HTTP 201/Created) with subscription details to caller. | 4. Data Model (Simplified) A minimal subscriptions table for the subscribe operation:
"subscriber_id": "usr_abc123", "plan_id": "plan_premium_monthly", "payment_method_id": "pm_card_visa", "trial_days": 0, "coupon_code": "WELCOME10"
CREATE TABLE subscriptions ( id UUID PRIMARY KEY, subscriber_id UUID NOT NULL, plan_id UUID NOT NULL, status VARCHAR(20) CHECK (status IN ('active', 'trialing', 'past_due', 'canceled', 'incomplete')), current_period_start TIMESTAMP, current_period_end TIMESTAMP, cancel_at_period_end BOOLEAN DEFAULT false, payment_method_id UUID, created_at TIMESTAMP DEFAULT NOW() ); Endpoint: POST /v1/subscriptions