This guide assumes you have a Chariow store with a License type product created. If you haven’t set one up yet, create your license product first.
What is a License Paywall?
A license paywall restricts access to your SaaS application (or specific features) until the user provides a valid license key. This is ideal for:- Desktop applications: Electron apps, native software, CLI tools
- Web applications: SaaS platforms, admin dashboards, premium tools
- Mobile apps: iOS/Android applications with premium features
- API access: Gating API usage based on license validity
How It Works
1
Customer Purchases License
Customer buys your license product on Chariow. A unique license key is automatically generated (e.g.,
ABC-123-XYZ-789).2
Customer Enters License Key
In your application, the customer enters their license key in a settings or activation screen.
3
Your App Validates the Key
Your application calls the Chariow API to validate the license key and check its status.
4
Access Granted or Denied
Based on the API response (
is_active, is_expired), your app grants or denies access.5
Optional: Activate on Device
For device-limited licenses, activate the license to track and limit device usage.
API Endpoints You’ll Need
Your API key (
sk_live_...) must be kept server-side only. Never expose it in client-side code.Architecture Patterns
Pattern 1: Server-Side Validation (Recommended)
Your backend validates licenses and controls access. Best for web applications.Pattern 2: Serverless/Edge Validation
Validate licenses at the edge using serverless functions. Good for static sites.Pattern 3: Desktop App with Periodic Validation
Desktop apps validate on startup and periodically. Includes offline grace period.Implementation Guide
Step 1: Create an API Route for License Validation
Your backend should expose an endpoint that your frontend calls:Step 2: Create the License Entry Component
Step 3: Wrap Your App with the License Gate
Device Activation (Optional)
If your license has limited activations, activate on the device:AI Prompts for Implementation
Use these prompts with Lovable, Cursor, Bolt, or any AI coding assistant to implement the license paywall quickly.Prompt 1: Basic License Paywall (React + Next.js)
Prompt 2: License Paywall with Device Activation
Prompt 3: Feature-Based Licensing
Prompt 4: Offline-Capable License Validation
Prompt 5: Complete Electron App Implementation
Prompt 6: Supabase Integration
Security Best Practices
Do’s
- Store API keys server-side in environment variables
- Validate on the backend before granting access
- Cache validation results to reduce API calls
- Implement rate limiting on your validation endpoint
- Use HTTPS for all API communications
- Log validation attempts for security auditing
Don’ts
- Don’t trust client-side validation alone - it can be bypassed
- Don’t store the full license object in accessible localStorage
- Don’t skip validation for “trusted” users
- Don’t hardcode license keys in your application
- Don’t expose detailed error messages that could help attackers
Testing Your Integration
Test Scenarios
Test License Keys
During development, create test products in your Chariow store with:- Free test licenses for development
- Short expiry periods to test expiration handling
- Limited activations to test device limits
Complete Example: Next.js App Router
Here’s a complete implementation using Next.js App Router:Next Steps
Licenses Guide
Learn more about license management
Licenses API
View the complete License API reference
Pulses (Webhooks)
Get notified when licenses are purchased
Best Practices
Security and integration best practices