Skip to content

feat(billing): implement subscription trial management with conversion optimization - #1045

Open
ayomideadeniran wants to merge 1 commit into
Smartdevs17:mainfrom
ayomideadeniran:feat/issue-958-trial-management
Open

feat(billing): implement subscription trial management with conversion optimization#1045
ayomideadeniran wants to merge 1 commit into
Smartdevs17:mainfrom
ayomideadeniran:feat/issue-958-trial-management

Conversation

@ayomideadeniran

Copy link
Copy Markdown

Summary

Implements comprehensive subscription trial management with dynamic conversion optimization across Soroban smart contracts and billing backend services.

Key Changes

1. Smart Contracts (contracts/subscription/src/)

  • Added trial.rs Soroban contract module defining OnChainTrialConfig, OnChainTrialRecord, OnChainTrialStatus, and TrialConversionMetrics.
  • Implemented authenticated trial operations: configure_trial_for_plan, start_trial, extend_trial, convert_trial, and evaluate_trial_expiration supporting grace periods and automatic conversion.
  • Registered module in contracts/subscription/src/lib.rs.

2. Backend Billing Service (backend/services/billing/)

  • Implemented TrialManagementService in backend/services/billing/trialManagementService.ts:
    • Trial Enrollment & Policy: Configurable trial durations (7, 14, 21, 30 days), grace periods, and auto-conversion toggles.
    • Propensity-to-Convert Engine: Weighted multi-signal scoring model (feature actions, logins, active days, dashboard views, exports) categorizing users into high_propensity, medium_propensity, at_risk, and disengaged.
    • Dynamic Conversion Incentives: Automated targeted promotional discounts and trial extension rewards.
    • Automated Reminder Queue: Multi-stage notifications (D-3, D-1 with promo codes, D-Day, and grace period final).
    • Auto-Conversion Pipeline: Scheduled job evaluation converting expired trials with applied discount BPS.
    • Conversion Funnel Analytics: Aggregates conversion rates, average conversion velocity, and attributed revenue.
  • Exported in backend/services/billing/index.ts.

3. Tests & Verification

  • Added backend/services/billing/__tests__/trialManagementService.test.ts with 13 comprehensive unit tests covering:
    • Policy configuration and trial start
    • Propensity scoring and dynamic incentive assignment
    • Extension limits and reason tracking
    • Manual conversion and automated expiration/auto-conversion
    • Reminder dispatching and revenue attribution metrics

Closes #958

…n optimization

- Added on-chain trial lifecycle module in Soroban contract (contracts/subscription/src/trial.rs)
- Added TrialManagementService in backend/services/billing with propensity scoring and reminder pipeline
- Added automated trial extensions, grace periods, and auto-conversion workflows
- Added comprehensive unit tests for trial management and conversion funnel analytics

Closes Smartdevs17#958
@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@ayomideadeniran Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement subscription trial management with conversion optimization

1 participant