Trial Period Manager

Payment → Silver
💰 $1000

Offer limited-time access before activating paid plans.

Technology iconTechnology iconTechnology icon

Trial Period Manager Overview

Purpose

The Trial Period Manager module is designed to handle the management of trial periods for users before they transition to paid plans. It serves as a crucial component in payment processing and user lifecycle management, facilitating a seamless onboarding experience that encourages conversion to paid services.

Benefits

Usage Scenarios

  1. Freemium Business Models: Ideal for businesses offering basic features for free while reserving advanced functionalities for paid users.
  2. SaaS Applications: Perfect for Software as a Service models aiming to showcase value before charging access.
  3. Subscription Services: Effective for services requiring users to experience the product before committing financially.
  4. Non-Subscription Products: Useful for offering trial periods even in non-subscription contexts, such as one-time purchase software.

Key Features

Integration

The module integrates seamlessly with existing systems through RESTful APIs. It provides comprehensive documentation and integration guides, allowing easy setup with minimal development effort.

Why Use This Module?

Quick Start

  1. Enable Trial Periods: Integrate the module into your application to begin offering trials.
  2. Customize Duration: Set trial lengths according to your business model (e.g., 7-day, 30-day trials).
  3. Integrate Tracking: Use provided APIs to monitor user activity and engagement during trials.
  4. Set Reminders: Configure push notifications and email reminders for users nearing trial expiration.
  5. Launch Onboarding Tours: Implement guided tours to showcase your product’s features effectively.
  6. Monitor Analytics: Utilize the dashboard to track key metrics and refine your approach based on user behavior.

By leveraging the Trial Period Manager, you can create a compelling, conversion-friendly experience that enhances user satisfaction and drives business growth.

Trial Period Manager Module Documentation

The Trial Period Manager module is designed to facilitate the management of trial periods for users, offering limited-time access before they transition to paid plans. This module caters to developers by providing essential features to streamline user experience and ensure smooth transitions from free trials to paid subscriptions.

Trial Activation

Automatically activates a trial period upon user sign-up, granting temporary access without requiring immediate payment. This feature helps attract users by offering them an initial taste of the service’s value.

Usage Tracking

Monitors user activity such as API calls or file uploads, ensuring they remain within predefined limits during their trial period. It enforces restrictions if usage exceeds these caps to prevent abuse and maintain service integrity.

Grace Periods

Offers a brief extension after the trial period ends, allowing users to continue using the service for a few additional days. This grace period reduces conversion friction by giving users time to decide on upgrading without immediate loss of access.

Expiry Handling

Manages the end of trials or grace periods by disabling accounts, revoking API keys, and restricting logins. These measures ensure security and prevent unauthorized use post-access expiry.

Plan Transitions

Simplifies the upgrade process by presenting paid plan options and handling payment processing seamlessly. This feature ensures a smooth transition from trial to paid plans, enhancing user satisfaction and conversion rates.

Analytics Tracking

Collects data on user behavior during trials, including conversion rates and usage patterns. These insights help businesses optimize marketing strategies and product development by understanding user engagement and churn.

Configuration Options

Allows customization of trial durations, available features, and expiry notifications. This flexibility accommodates varying business needs without extensive code modifications, ensuring the module adapts to different use cases.

Session Limits

Controls access through login attempts or session timeouts, preventing unauthorized sharing of trial accounts. It ensures that only registered users can utilize the service during their trial period, enhancing security.

Notifications

Sends reminders via email, in-app messages, or push notifications as trials near expiry. These prompts encourage users to upgrade before losing access, thereby reducing the likelihood of forgotten conversions and attrition.

This module’s comprehensive features ensure effective management of trial periods, enhancing user experience while optimizing business strategies for conversion and retention.

Module Documentation: Trial Period Manager

This module manages trial periods for users before they subscribe to paid plans.

1. FastAPI Endpoint (Backend)

from fastapi import APIRouter, Depends, HTTPException
from typing import Optional
from datetime import datetime, timedelta
from pydantic import BaseModel

router = APIRouter()

class TrialPeriodManager:
    def __init__(self):
        self.trial_expiration = None  # Store trial expiration date

    async def get_trial_status(self, user_id: str) -> dict:
        """Get current trial status for a user."""
        if not self.trial_expiration:
            return {"status": "no_TRIAL", "expires_in": 0}
        
        remaining_time = (self.trial_expiration - datetime.now()).total_seconds()
        return {
            "status": "trial",
            "expires_in": max(remaining_time, 0),
            "is_expired": self.is_trial_expired()
        }

    def start_trial(self, user_id: str) -> None:
        """Start a trial period for a user."""
        self.trial_expiration = datetime.now() + timedelta(days=14)
    
    def extend_trial(self, user_id: str) -> bool:
        """Extend trial period by 7 days if not expired."""
        if not self.is_trial_expired():
            self.trial_expiration += timedelta(days=7)
            return True
        return False
    
    def is_trial_expired(self) -> bool:
        """Check if trial has expired."""
        return self.trial_expiration < datetime.now()

# Example usage:
# trial_manager = TrialPeriodManager()
# trial_manager.start_trial("123")
# status = await trial_manager.get_trial_status("123")  # Returns trial status

2. React UI (Frontend)

import React, { useState } from 'react';
import axios from 'axios';

const TrialStatusChecker = () => {
    const [status, setStatus] = useState<string>('Checking...');
    const [loading, setLoading] = useState(false);

    const checkTrialStatus = async () => {
        setLoading(true);
        try {
            const response = await axios.get('/api/trial/status');
            setStatus(response.data.status);
        } catch (error) {
            console.error('Error checking trial status:', error);
            setStatus('error');
        }
        setLoading(false);
    };

    const extendTrial = async () => {
        setLoading(true);
        try {
            await axios.post('/api/trial/extend', {});
            checkTrialStatus();
        } catch (error) {
            console.error('Error extending trial:', error);
        }
        setLoading(false);
    };

    return (
        <div>
            {loading ? (
                <p>Loading...</p>
            ) : (
                <>
                    <h2>Trial Status: {status}</h2>
                    {!['expired', 'no_TRIAL'].includes(status) && (
                        <button onClick={extendTrial}>
                            Extend Trial
                        </button>
                    )}
                </>
            )}
        </div>
    );
};

export default TrialStatusChecker;

3. Data Schema (Pydantic)

from pydantic import BaseModel
from typing import Optional

class TrialStart(BaseModel):
    user_id: str
    """Unique identifier of the user"""

class TrialExtend(BaseModel):
    user_id: str
    """Unique identifier of the user"""
    extend_days: int = 7
    """Number of days to extend trial (default is 7)"""

class TrialStatus(BaseModel):
    status: str
    """Trial status:
    - 'trial': Active trial period
    - 'expired': Trial has expired
    - 'no_TRIAL': No active trial or subscription
    """
    expires_in: Optional[int] = None
    """Time remaining in seconds if status is 'trial'"""
    is_expired: bool
    """Whether the trial has expired"""

Example Interaction Flow

  1. User starts trial:
POST /api/trial
{
  "user_id": "123"
}
  1. Extend trial before expiration:
POST /api/trial/extend
{
  "user_id": "123"
}
  1. Check status:
GET /api/trial/status
# Response:
{
  "status": "trial",
  "expires_in": 86400,
  "is_expired": false
}

This module provides a complete solution for managing trial periods with start, extend, and status checking functionality while integrating seamlessly with both backend (FastAPI) and frontend (React) components.

Trial Period Manager Module Documentation

Overview

The Trial Period Manager module provides functionality to manage trial periods for users before they activate paid plans. It allows users to access your product or service for a limited time, encouraging them to upgrade to paid plans while improving conversion rates.


Here are some modules that integrate closely with the Trial Period Manager:

  1. User Authentication Module

    • Manages user sign-up and authentication.
    • Integrates with trial period logic to enforce access controls.
  2. Payment Processing Module

    • Handles payment gateways for upgrading users from trials to paid plans.
    • Works with Trial Period Manager to trigger payments upon trial expiration or upgrade actions.
  3. Subscription Management Module

    • Manages subscription plans and billing cycles.
    • Coordinates with Trial Period Manager to transition users from trial periods to paid subscriptions seamlessly.
  4. Usage Analytics Module

    • Tracks user activity during the trial period.
    • Provides insights into trial usage to help identify potential customers for targeted outreach.
  5. Notifications Module

    • Sends email and in-app notifications about trial expirations, upgrades, and续费 reminders.
    • Integrates with Trial Period Manager to ensure timely communication with users.

Use Cases

1. Offering Free Trials on Product Pages

Implementation Notes:

2. Managing Trial Expiration

Implementation Notes:

3. Enforcing Usage Limits During Trials

Implementation Notes:


Integration Tips

  1. Set Up User Roles and Access Control:

    • Assign trial users a specific role (e.g., “trial_user”).
    • Restrict access to premium features based on user role.
  2. Integrate with Payment Gateways:

    • Use the Payment Processing Module to handle upgrades.
    • Ensure seamless transitions between free trials and paid plans.
  3. Track Usage Limits:

    • Implement API calls or database triggers to monitor usage during trials.
    • Provide clear feedback in the UI when users exceed their trial limits.
  4. Provide Clear Trial Status Indicators:

    • Show remaining days, features locked, or upgrade options in the UI.
    • Use icons and color codes (e.g., red for expired, green for active).
  5. Monitor Trial Expiry and Grace Periods:

    • Use the Notifications Module to send reminders during the grace period.
    • Ensure that users are not charged after the trial expires unless they explicitly choose to upgrade.

Configuration Options

Below is a table of configuration options for the Trial Period Manager module:

OptionDescriptionData TypeDefault Value
enable_trial_periodEnables or disables the trial period functionality.Booleantrue
trial_duration_daysNumber of days in the trial period.Integer14
grace_period_daysAdditional days users have after trial expiration to upgrade or extend.Integer0
max_trial_usage_attemptsMaximum number of API calls or resource usages allowed during trials.Integer100
send_notification_emailsWhether to send email notifications for trial expirations.Booleantrue
trial_access_typeType of access (e.g., full, limited).String”full”
custom_expiry_logicCustom logic or callback function for determining trial expiry.Functionnull

API Reference

The Trial Period Manager module provides the following endpoints:

  1. GET /api/v1/trial-period

    • Checks if a user is eligible for a trial period.
    • Returns remaining days, usage limits, and status.
  2. POST /api/v1/upgrade

    • Handles upgrading users from trials to paid plans.
    • Triggers payment processing and updates the user’s subscription status.
  3. GET /api/v1/usage

    • Retrieves usage metrics for trial period tracking.
    • Returns data on API calls, resource usage, or feature usage.

Known Issues and Limitations


This documentation provides a comprehensive guide to integrating and configuring the Trial Period Manager module. For further assistance, refer to the API documentation or contact support.