Digital Products Payment Guide: License Keys, Subscriptions, and Automated Delivery
Selling digital products (software licenses, ebooks, online courses, membership subscriptions) is simpler than selling physical goods — there are no logistics or inventory issues. However, to achieve automated sales (users receive the product immediately after payment), you need a complete payment + delivery system.
1. Digital Product Sales Process
A complete digital product sales process includes:
User browses → Payment processing → Tax compliance → Product delivery → After-sales support
↓
License Key generation
Download link sent
Account access granted
2. Major Solution Comparison
Platform-Based Solutions
| Platform | Monthly Fee | Transaction Fee | Best For | Features |
|---|---|---|---|---|
| LemonSqueezy | $0 | 5% + $0.50 | Software/ebooks/courses | Auto tax handling, License Key |
| Gumroad | $0 | 8.5% + $0.30 | Ebooks/design assets | Strong community features |
| Sellfy | $19/month | 0% | Digital files | Simple and easy to use |
| Payhip | $0 | 5% | Ebooks/courses | Tax compliance |
| Paddle | $0 | 5% + $0.50 | SaaS/software | Enterprise tax handling |
Self-Built Solution (Stripe + Code)
Cost: Stripe rate 2.9% + $0.30 (no platform commission)
Flexibility: Highest
Development cost: Need to build your own delivery system
Tax: Need to handle global tax yourself
3. License Key Management System
3.1 What is a License Key
A License Key is a common authorization method for software products. Users receive a unique authorization code after purchase to activate the software.
3.2 Using LemonSqueezy's License Key Feature
LemonSqueezy has built-in License Key generation and management:
// Validate License Key
const response = await fetch('https://api.lemonsqueezy.com/v1/licenses/validate', {
method: 'POST',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
license_key: userInputKey,
instance_id: machineId,
}),
});
const { valid, error, license_key } = await response.json();
if (valid) {
// Activate software
activateSoftware(license_key);
}
3.3 Building Your Own License Key System
// Simple License Key generation
const crypto = require('crypto');
function generateLicenseKey(productId, customerEmail) {
const data = `${productId}-${customerEmail}-${Date.now()}`;
const hash = crypto.createHash('sha256').update(data).digest('hex');
// Group display: XXXXX-XXXXX-XXXXX-XXXXX
const key = hash.substring(0, 20).toUpperCase()
.replace(/(.{5})/g, '$1-')
.slice(0, -1);
return key;
}
4. Subscription Management System
4.1 Stripe Billing Solution
Stripe provides comprehensive subscription management features:
// Create subscription
const subscription = await stripe.subscriptions.create({
customer: customerId,
items: [{ price: 'price_monthly_123' }],
payment_behavior: 'default_incomplete',
expand: ['latest_invoice.payment_intent'],
});
// Subscription lifecycle handling
// Listen for subscription events via Webhook
switch (event.type) {
case 'invoice.payment_succeeded':
// Extend subscription validity
extendSubscription(event.data.object.subscription);
break;
case 'invoice.payment_failed':
// Send dunning email
sendDunningEmail(event.data.object.customer);
break;
case 'customer.subscription.deleted':
// Revoke user access
revokeAccess(event.data.object.id);
break;
}
4.2 Subscription State Machine
active
↓ User cancels
cancel_at_period_end
↓ Period ends
canceled
active
↓ Payment fails
past_due
↓ Failed retries after 3 days
unpaid
↓ No action taken
canceled
5. Automated Delivery Flow
5.1 Post-Payment Automation
// Webhook handling for successful payments
app.post('/webhook', async (req, res) => {
const event = req.body;
if (event.type === 'checkout.session.completed') {
const session = event.data.object;
const customerEmail = session.customer_details.email;
const productId = session.metadata.product_id;
// 1. Generate License Key
const licenseKey = generateLicenseKey(productId, customerEmail);
// 2. Send email (with download link and License Key)
await sendDeliveryEmail(customerEmail, {
productId,
licenseKey,
downloadUrl: generateDownloadUrl(productId, licenseKey),
});
// 3. Record to database
await database.saveOrder({
email: customerEmail,
productId,
licenseKey,
status: 'delivered',
});
}
res.json({ received: true });
});
5.2 File Protection
Digital file download links should be temporary and one-time use:
// Generate temporary download link (valid for 24 hours)
const crypto = require('crypto');
function generateDownloadUrl(productId, customerEmail) {
const token = crypto.randomBytes(32).toString('hex');
const expiresAt = Date.now() + 24 * 60 * 60 * 1000;
// Save token to database
saveToken(token, productId, customerEmail, expiresAt);
return `https://yourdomain.com/download/${token}`;
}
6. Tax Compliance
6.1 Tax Requirements by Region
| Region | Tax Type | Needs Auto-Processing |
|---|---|---|
| EU | VAT | Recommended to use MoR |
| UK | VAT | Recommended to use MoR |
| US | Sales Tax (varies by state) | Recommended to use MoR |
| China | VAT | Requires domestic qualifications |
6.2 MoR (Merchant of Record) Model
The biggest advantage of using LemonSqueezy or Paddle is that they act as the Merchant of Record, taking on tax compliance responsibilities:
- Charges customers tax-inclusive prices
- Automatically calculates and remits global VAT/sales tax
- Issues compliant invoices
- Sellers don't need to worry about tax issues
7. Solution Recommendations
Indie Developer (Solo Publisher)
Recommended: LemonSqueezy
Reason: Zero monthly fee, auto tax handling, built-in License Key management
Add: Your own website as the sales page
Small SaaS Team
Recommended: Stripe Billing
Reason: High flexibility, low fees, supports complex subscription logic
Add: Manage tax yourself (or use tools like TaxJar)
Mid-to-Large Software Company
Recommended: Paddle
Reason: Enterprise-grade tax handling, professional checkout experience, multi-channel sales support
8. Summary
Choosing a payment solution for digital product sales depends on product type, sales volume, and tax handling capabilities. For indie developers, LemonSqueezy offers the most hassle-free solution. For SaaS teams maximizing profits, the Stripe direct integration requires more self-management but has lower long-term costs. Regardless of the solution, ensuring fully automated post-payment delivery is key — users expect to access their product the moment payment is complete.