Skip to Content
Quickstart

Quickstart

Start monetizing your application in 10 minutes. Choose the right SDK and follow step-by-step instructions for quick integration.

Choose the Right SDK

The platform provides two main integration approaches:

Client-Side SDK - Recommended for Quick Start

Advantages:

  • Ready-made UI components
  • Built-in user authentication
  • Customizable themes and colors
  • Minimal integration effort
  • Automatic state management

📱 Perfect for:

  • Websites and SPAs
  • Chrome extensions
  • MVPs and rapid prototypes
  • Teams with limited frontend resources

Check out for our guides

Client-Side SDK

Get a working paywall in 5 minutes with ready-made components.

Step 1: Create Paywall

  1. Log into the dashboard
  2. Go to “Paywalls”“New Paywall”
  3. Select “Client Mode”
  4. Fill in basic information:
    • Paywall name
    • Product name on checkout page
    • Paywall title
    • Support email

Step 2: Configure Pricing

  1. Click “Add Plan”
  2. Set price and period (month/year/lifetime)
  3. Add multiple plans if needed (с разными периодами оплаты)
  4. Mark recommended plan

Step 3: Create Payment Processor

  1. Go to “Payment Processors”“New Payment Processor”
  2. Choose Stripe or Paddle
  3. Enter API keys (start with test mode)
  4. Save configuration

Step 4: Connect Processor to Paywall

  1. Open your paywall settings
  2. Go to “Payment Processor” tab
  3. Select the created payment processor
  4. Save changes

Step 5: Install SDK

  1. In paywall settings, click “Install”
  2. Copy the provided script
  3. Insert script into <head> or beginning of <body> of your page:
<script> // Your unique script will be here // Copy the exact script from the dashboard </script>

Step 6: Use the SDK

Now you can use the paywall in your code:

// Open paywall paywall.open(); // Get user information const userInfo = await paywall.getUser(); if (userInfo.paid) { // User has paid subscription enablePremiumFeatures(); } else { // Show limitations showUpgradePrompt(); } // Check token balance (for tokenized paywalls) const tokens = userInfo.balances.find(b => b.type === 'standard'); if (tokens && tokens.count > 0) { // User has tokens allowAction(); }

Ready-to-Use Examples

// Simple integration document.addEventListener('DOMContentLoaded', function() { // Show paywall on button click document.getElementById('upgrade-btn').addEventListener('click', function() { paywall.open(); }); // Check user status on page load checkUserStatus(); }); async function checkUserStatus() { try { const userInfo = await paywall.getUser(); if (userInfo.paid) { document.body.classList.add('premium-user'); } } catch (error) { console.log('User not authenticated'); } }

Server-Side SDK

Build custom interfaces with full control over UX.

Step 1: Create Paywall in Server Mode

  1. Log into the dashboard
  2. Create a new paywall, selecting “Server Mode”
  3. Configure basic information and pricing
  4. Create and connect payment processor

Step 2: Get API Keys

  1. Go to “Settings”“API Keys”
  2. Create a new API key or copy existing one
  3. Find your paywall ID in its settings

Step 3: Get Price List

// Server function to get prices async function getPaywallPrices(paywallId) { const response = await fetch(`https://onlineapp.pro/api/v1/paywall/${paywallId}/prices`, { method: 'GET', headers: { 'Content-Type': 'application/json', 'x-api-key': process.env.PAYWALL_API_KEY } }); const result = await response.json(); return result.data; // Array of prices }

Step 4: Create Checkout

// Server function to create payment async function createCheckout(userEmail, priceId, paywallId) { const response = await fetch(`https://onlineapp.pro/api/v1/paywall/${paywallId}/start-checkout`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-api-key': process.env.PAYWALL_API_KEY }, body: JSON.stringify({ email: userEmail, priceId: priceId, successUrl: 'https://yoursite.com/payment/success', errorUrl: 'https://yoursite.com/payment/error', shopUrl: 'https://yoursite.com/pricing', trial_days: 7, // Optional userMeta: { source: 'website', campaign: 'spring_sale' } }) }); return response.json(); }

Step 5: Setup Webhooks

// Webhook handler for payment tracking app.post('/webhook/paywall', express.raw({type: 'application/json'}), (req, res) => { const event = req.body; switch (event.type) { case 'payment.completed': // User successfully paid console.log('Payment completed:', event.data); activateUserSubscription(event.data.user.id); break; case 'refund.created': // Refund created console.log('Refund created:', event.data); handleRefund(event.data.user.id); break; case 'subscription.cancelled': // Subscription cancelled deactivateUserSubscription(event.data.user.id); break; } res.json({received: true}); });

Step 6: Create Interface

// Example React component for pricing page import React, { useState, useEffect } from 'react'; function PricingPage() { const [prices, setPrices] = useState([]); const [loading, setLoading] = useState(false); useEffect(() => { // Load prices from server fetch('/api/prices') .then(res => res.json()) .then(setPrices); }, []); const handleSubscribe = async (priceId, planName) => { setLoading(true); try { const response = await fetch('/api/create-checkout', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ priceId, email: userEmail, // From your authentication system planName }) }); const data = await response.json(); if (data.checkoutUrl) { window.location.href = data.checkoutUrl; } } catch (error) { console.error('Checkout creation error:', error); } finally { setLoading(false); } }; return ( <div className="pricing-page"> <h1>Choose a Plan</h1> <div className="pricing-grid"> {prices.map(price => ( <div key={price.id} className="pricing-card"> <h3>{price.interval} plan</h3> <p className="price">${price.unit_amount}</p> <button onClick={() => handleSubscribe(price.id, `${price.interval} plan`)} disabled={loading} > {loading ? 'Creating...' : 'Choose Plan'} </button> </div> ))} </div> </div> ); }

Complete Express.js Example

// routes/paywall.js const express = require('express'); const router = express.Router(); const PAYWALL_ID = process.env.PAYWALL_ID; const API_KEY = process.env.PAYWALL_API_KEY; // Get prices router.get('/prices', async (req, res) => { try { const response = await fetch(`https://onlineapp.pro/api/v1/paywall/${PAYWALL_ID}/prices`, { headers: { 'x-api-key': API_KEY } }); const result = await response.json(); res.json(result.data); } catch (error) { res.status(500).json({ error: 'Failed to fetch prices' }); } }); // Create checkout router.post('/create-checkout', async (req, res) => { const { email, priceId, planName } = req.body; try { const response = await fetch(`https://onlineapp.pro/api/v1/paywall/${PAYWALL_ID}/start-checkout`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-api-key': API_KEY }, body: JSON.stringify({ email, priceId, successUrl: `${req.protocol}://${req.get('host')}/payment/success`, errorUrl: `${req.protocol}://${req.get('host')}/payment/error`, shopUrl: `${req.protocol}://${req.get('host')}/pricing`, userMeta: { planName, source: 'website' } }) }); const result = await response.json(); res.json(result); } catch (error) { res.status(500).json({ error: 'Failed to create checkout' }); } }); module.exports = router;

Need help? Join our Telegram community  or contact support.

Last updated on