Payments Guide
Payments Guide
How to accept payments in your application. Covers different payment providers and business models. Written for all skill levels.
Table of Contents
- Understanding Payments
- Business Models
- Payment Providers
- Provider Comparison
- Implementing Credits/Tokens
- Webhooks
- Security Best Practices
- Tax Considerations
Understanding Payments
How Online Payments Work
When a customer buys something online, many parties are involved:
Important: Your app NEVER sees the customer's credit card number. The payment provider handles that securely.
Key Terms
| Term | Meaning | Example |
|---|---|---|
| Payment Provider | Company that processes payments for you | Stripe, Square, PayPal |
| Merchant | You (the seller) | Your app/company |
| Transaction Fee | Cut the provider takes | 2.9% + $0.30 per charge |
| Webhook | Automatic notification when something happens | "Payment completed" message to your server |
| PCI Compliance | Security standards for handling cards | Payment providers handle this for you |
| Payout | Money transferred to your bank | Weekly or daily transfers |
| Chargeback | Customer disputes a charge | "I didn't make this purchase" |
| Refund | You return money to customer | Full or partial return |
Business Models
One-Time Purchase
What it is: Customer pays once, gets the product forever.
Examples:
- Desktop software license
- E-book purchase
- One-time report/download
Pros:
- Simple to implement
- Customer knows exactly what they're paying
- No recurring billing issues
Cons:
- Need to keep finding new customers
- No predictable monthly revenue
- Updates/support not funded long-term
Best for: Software with clear, complete features that don't need ongoing updates.
Subscriptions
What it is: Customer pays regularly (monthly/yearly) for ongoing access.
Examples:
- Netflix, Spotify
- Adobe Creative Cloud
- SaaS products (Notion, Slack)
Common Subscription Tiers:
| Tier | Price | Features |
|---|---|---|
| Free | $0 | Limited features, ads, or trials |
| Basic | $10/mo | Core features |
| Pro | $25/mo | All features |
| Team/Business | $50/mo | Multi-user, admin features |
Pros:
- Predictable recurring revenue
- Builds long-term customer relationships
- Funds ongoing development
Cons:
- Higher churn (people cancel)
- Need to continuously provide value
- More complex billing logic
Best for: Products that provide ongoing value and need continuous updates.
Rent-to-Own
What it is: Customer makes payments over time, then owns the product.
How it differs from subscription:
| Subscription | Rent-to-Own |
|---|---|
| Pay forever to keep access | Pay for a fixed period, then own it |
| Miss a payment = lose access | Miss a payment = pause progress |
| Never "own" the product | Eventually own the product |
Examples:
- Software with payment plans
- Equipment financing
- "Pay in 4" options (like Klarna, Afterpay)
Pros:
- Lower barrier to entry (smaller payments)
- Customer feels they're building toward ownership
- Can charge more total than one-time purchase
Cons:
- Complex tracking (how many payments left?)
- Risk of customers abandoning mid-way
- Need to handle partial ownership states
Best for: Expensive products where customers want smaller payments.
Credits/Tokens
What it is: Customer buys "credits" that they spend on usage.
Credit Pricing Examples:
| Package | Credits | Price | Per Credit |
|---|---|---|---|
| Starter | 100 | $5 | $0.050 |
| Standard | 500 | $20 | $0.040 |
| Pro | 1500 | $50 | $0.033 |
| Enterprise | 5000 | $150 | $0.030 |
Notice: Bigger packages = better value per credit (volume discount).
Pros:
- Pay-for-what-you-use model
- Customers feel in control
- Works great for AI/API usage
- Low commitment for customers to try
Cons:
- Less predictable revenue
- Customers may hoard credits
- Need to track balances carefully
- Can feel "nickel-and-diming"
Best for: AI features, API calls, anything with variable usage costs.
Choosing a Model
Hybrid Approach (Common for AI Apps):
Many apps combine models:
| Component | Model |
|---|---|
| Base app access | Subscription ($10/mo) |
| AI features | Credits (buy as needed) |
| Premium themes | One-time purchase ($5 each) |
Payment Providers
Stripe
What it is: The most popular payment provider for developers. Used by Shopify, Lyft, Slack, and millions of businesses.
Pricing:
| Service | Cost |
|---|---|
| Card payments | 2.9% + $0.30 per transaction |
| International cards | +1.5% |
| Subscriptions | No extra fee |
| Payouts | Free (to your bank) |
Pros:
- Excellent documentation
- Works worldwide
- Handles taxes (Stripe Tax)
- Great developer tools
- Webhooks for everything
Cons:
- 2.9% adds up on large volumes
- Account can be frozen for "high risk" businesses
- Support can be slow
Best for: Most online businesses, especially SaaS and marketplaces.
Square
What it is: Payment provider known for physical point-of-sale (the card readers at stores), but also does online payments.
Pricing:
| Service | Cost |
|---|---|
| Online payments | 2.9% + $0.30 per transaction |
| In-person (card reader) | 2.6% + $0.10 |
| Invoices | 3.3% + $0.30 |
Pros:
- Great if you also sell in-person
- Built-in inventory management
- Free online store builder
- Good for small businesses
Cons:
- Developer tools not as good as Stripe
- Less flexible for complex billing
- Mainly US-focused
Best for: Businesses that sell both online AND in physical stores.
PayPal
What it is: The original online payment system. Many customers already have PayPal accounts.
Pricing:
| Service | Cost |
|---|---|
| Standard payments | 3.49% + $0.49 per transaction |
| PayPal Checkout | 2.9% + $0.30 |
| International | +1.5% |
Pros:
- Customers trust PayPal
- Many people already have accounts
- Buyer protection increases trust
- "Pay with PayPal" button is familiar
Cons:
- Higher fees than competitors
- Can freeze accounts unexpectedly
- Customer service issues
- Disputes favor buyers heavily
Best for: Adding as a secondary payment option alongside Stripe.
Paddle
What it is: A "Merchant of Record" - they handle taxes, compliance, and billing for you.
What "Merchant of Record" means:
Pricing:
| Service | Cost |
|---|---|
| Transactions | 5% + $0.50 per transaction |
Pros:
- Handles ALL global taxes (VAT, GST, sales tax)
- Handles compliance and legal stuff
- One invoice to you (simple accounting)
- Great for selling to EU (VAT is complex)
Cons:
- Higher fees (5% vs 2.9%)
- Less control over customer relationship
- Paddle's name on receipts, not yours
Best for: Solo developers selling globally who don't want to deal with taxes.
LemonSqueezy
What it is: Similar to Paddle - a Merchant of Record focused on digital products.
Pricing:
| Service | Cost |
|---|---|
| Transactions | 5% + $0.50 per transaction |
Pros:
- Beautiful checkout pages
- Handles taxes globally
- Built for digital products
- Good affiliate system
- License key generation built-in
Cons:
- Higher fees
- Newer company (less proven)
- Fewer features than Stripe
Best for: Indie developers selling software, courses, or digital downloads.
Gumroad
What it is: Simple platform for selling digital products.
Pricing:
| Plan | Monthly Fee | Transaction Fee |
|---|---|---|
| Free | $0 | 10% |
| Creator | $10/mo | 5% |
Pros:
- Very simple to set up
- Built-in audience features
- Good for creators/artists
- Handles taxes
Cons:
- High fees on free plan
- Limited customization
- Not for complex products
Best for: Artists, writers, creators selling simple digital products.
Provider Comparison
| Feature | Stripe | Square | PayPal | Paddle | LemonSqueezy |
|---|---|---|---|---|---|
| Base Fee | 2.9% + $0.30 | 2.9% + $0.30 | 3.49% + $0.49 | 5% + $0.50 | 5% + $0.50 |
| Handles Taxes | Optional add-on | No | No | Yes | Yes |
| Subscriptions | Yes | Yes | Yes | Yes | Yes |
| Global | Yes | Limited | Yes | Yes | Yes |
| Developer Tools | Excellent | Good | Okay | Good | Good |
| Setup Time | 1-2 hours | 1 hour | 30 min | 1 hour | 30 min |
| Best For | SaaS, Marketplaces | Retail + Online | Secondary option | Global sales | Digital products |
Decision Flowchart
Implementing Credits/Tokens
How AI Credits Work
For apps with AI features, credits let you charge for actual usage:
Credit System Design
How many credits should things cost?
Base it on YOUR costs:
| Your Cost | Credit Cost | Your Markup |
|---|---|---|
| AI call costs you $0.01 | Charge 10 credits | If 1000 credits = $10, that's $0.10 = 10x markup |
| AI call costs you $0.05 | Charge 50 credits | Same math |
Example pricing structure:
| Feature | Your Cost | Credits Charged | Your Revenue |
|---|---|---|---|
| Short AI response | $0.005 | 5 credits | $0.05 |
| Long AI response | $0.02 | 25 credits | $0.25 |
| AI image generation | $0.04 | 50 credits | $0.50 |
| Document analysis | $0.10 | 100 credits | $1.00 |
Tracking Usage
Your database needs to track:
┌─────────────────────────────────────────────────────────────┐
│ USER CREDITS TABLE │
├─────────────────────────────────────────────────────────────┤
│ user_id │ credits_balance │ lifetime_purchased │
│ user_123 │ 450 │ 2000 │
│ user_456 │ 1200 │ 1500 │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ CREDIT TRANSACTIONS │
├─────────────────────────────────────────────────────────────┤
│ id │ user_id │ type │ amount │ description │
│ 1 │ user_123 │ purchase │ +1000 │ Bought Pro pack │
│ 2 │ user_123 │ usage │ -50 │ AI generation │
│ 3 │ user_123 │ usage │ -25 │ AI chat │
│ 4 │ user_123 │ refund │ +100 │ Failed generation │
└─────────────────────────────────────────────────────────────┘
Webhooks
What Are Webhooks?
Webhooks are automatic notifications from the payment provider to your server.
Without webhooks:
With webhooks:
Common Webhook Events
| Event | What Happened | Your Action |
|---|---|---|
payment_intent.succeeded |
Payment completed | Grant access, send receipt |
payment_intent.failed |
Payment failed | Show error, suggest retry |
customer.subscription.created |
New subscription | Create user account |
customer.subscription.deleted |
Subscription cancelled | Revoke access |
invoice.paid |
Subscription renewed | Continue access |
invoice.payment_failed |
Renewal failed | Send warning email |
charge.refunded |
Refund issued | Revoke access |
Webhook Flow
Important: Always verify webhook signatures! Otherwise, anyone could fake a "payment succeeded" message.
Security Best Practices
Do's
| Practice | Why |
|---|---|
| Use HTTPS everywhere | Encrypts payment data |
| Verify webhook signatures | Prevents fake payment notifications |
| Never store card numbers | Let payment provider handle it |
| Use payment provider's UI | They handle PCI compliance |
| Log all transactions | For disputes and debugging |
| Implement idempotency | Prevents double-charging |
Don'ts
| Practice | Why It's Dangerous |
|---|---|
| Build your own payment form | PCI compliance nightmare |
| Store card numbers | Huge liability if breached |
| Trust client-side only | Users can modify amounts |
| Skip webhook verification | Anyone can fake payments |
| Ignore failed payments | Lost revenue, angry customers |
Secure Payment Flow
Key point: Credit card numbers NEVER touch your server. They go directly to Stripe.
Tax Considerations
Why Taxes Matter
When you sell online, you might owe taxes to:
- Your country/state
- The customer's country/state
- Sometimes both!
Who Handles What
| Provider Type | Who Handles Taxes |
|---|---|
| Stripe, Square, PayPal | YOU must calculate and pay |
| Paddle, LemonSqueezy | THEY handle it for you |
Tax Complexity by Region
| Region | Complexity | Notes |
|---|---|---|
| US | Medium | Different rules per state |
| EU | High | VAT rules, different rates per country |
| UK | Medium | VAT after Brexit |
| Canada | Medium | GST + provincial taxes |
| Australia | Low | Flat 10% GST |
Solutions
- Use a Merchant of Record (Paddle, LemonSqueezy) - they handle everything
- Use Stripe Tax - Stripe calculates and collects (you still pay)
- Hire an accountant - for complex situations
- Tax software - TaxJar, Avalara
Quick Reference
┌─────────────────────────────────────────────────────────────┐
│ PAYMENT MODELS │
├─────────────────────────────────────────────────────────────┤
│ One-Time: Pay once, own forever │
│ Subscription: Pay monthly/yearly for access │
│ Rent-to-Own: Pay installments, then own │
│ Credits: Buy credits, spend on usage │
├─────────────────────────────────────────────────────────────┤
│ PROVIDER FEES │
├─────────────────────────────────────────────────────────────┤
│ Stripe: 2.9% + $0.30 (you handle taxes) │
│ Paddle: 5% + $0.50 (they handle taxes) │
│ Square: 2.9% + $0.30 (you handle taxes) │
│ PayPal: 3.49% + $0.49 (you handle taxes) │
├─────────────────────────────────────────────────────────────┤
│ RECOMMENDATIONS │
├─────────────────────────────────────────────────────────────┤
│ SaaS app: Stripe │
│ Global sales: Paddle (handles VAT) │
│ Physical + Online: Square │
│ AI credits: Stripe + custom tracking │
└─────────────────────────────────────────────────────────────┘