Billing is the part of a SaaS product where bugs cost money directly: a missed webhook means a paying customer loses access, a duplicated one charges twice, and a broken dunning email lets churn creep up silently. This guide focuses on the infrastructure that makes subscription billing dependable on your own servers. Our SaaS architecture guide covers the general stack.
How a Subscription Payment Flows
- The customer chooses a plan; your app creates a checkout or subscription with the payment gateway.
- The gateway collects payment (card, UPI AutoPay mandate or other supported method).
- The gateway sends webhook events: payment succeeded, failed, subscription renewed, cancelled.
- Your webhook endpoint verifies and records each event, then updates the customer's entitlements.
- Background jobs send receipts and invoices, reminders before renewal, and dunning messages after failures.
Your database is the source of truth for what each customer can use; the gateway is the source of truth for money. Keeping them in sync is the core job.
Reliable Webhook Handling
- Verify signatures on every webhook using the gateway's secret.
- Respond quickly (store the event, return 200) and process it in a background job.
- Be idempotent: gateways retry, so the same event may arrive more than once; store event IDs and ignore duplicates.
- Handle ordering: events can arrive out of order; use timestamps and current state from the gateway's API when in doubt.
- Reconcile daily: compare your records with the gateway's to catch missed events.
- Alert on webhook failures and on unusual spikes in failed payments.
Entitlements
Model what each plan includes (features, seats, usage limits) separately from the payment record. When a subscription changes, update entitlements in one place, and have the application check entitlements rather than plan names scattered through the code. This makes upgrades, downgrades, trials, grace periods and custom deals manageable.
Failed Payments and Dunning
- Retry failed payments on a schedule the gateway supports.
- Notify customers by email (and in-app) with a clear way to update their payment method.
- Give a grace period before restricting access, and restrict gracefully (read-only) rather than deleting data.
- Track recovery rates; small improvements in dunning recover meaningful revenue.
Usage-Based Billing
If you charge by usage (API calls, seats, storage, messages), record usage events reliably, aggregate them per billing period in background jobs, and show customers their current usage. Make aggregation idempotent so reprocessing a period never double-counts.
Invoices and Tax
Generate invoices for each payment with the details your tax obligations require (for Indian customers this often means GST-compliant invoices with your GSTIN and the customer's details where provided). Store invoice PDFs durably and back them up. Take professional advice on your specific tax position.
Infrastructure on VPS
| Component | Hosting |
|---|---|
| Web app and API | Behind Nginx with HTTPS; several processes |
| Webhook endpoint | Same app, separate route; fast response, queue the work |
| Workers | Supervised services processing billing jobs, emails, usage aggregation |
| Database | PostgreSQL or MySQL with point-in-time backups |
| Queue and cache | Redis with persistence for queues |
| Transactional email service with SPF and DKIM |
Run workers as systemd services with automatic restarts (see our workers guide), and keep the webhook route available during deploys with zero-downtime releases.
Reliability for Payment Flows
- External uptime checks on the webhook endpoint and the checkout pages.
- Alerts on queue backlogs and failed jobs (see our monitoring guide).
- Database backups with point-in-time recovery; billing data must never be lost.
- A staging environment connected to the gateway's test mode for testing changes.
Security
Never store full card numbers; let the gateway handle card data through its hosted checkout or tokens. Protect webhook secrets and API keys in environment files with restricted permissions, restrict admin billing actions to a few people, and log every manual change to subscriptions.
Cost per Subscriber
Track infrastructure cost per active subscriber: servers, backups, email and monitoring divided by subscribers. On fixed-price VPS plans with unmetered bandwidth, this usually falls as you grow, until a tier upgrade; it tells you when optimisation or re-pricing is worth the effort.
Sizing
| Stage | Setup |
|---|---|
| Launch | 4 vCores / 16 GB production + 2 vCores / 8 GB staging |
| Growth | App server + 8 vCores / 32 GB database + staging |
| Scale | Several app servers behind a load balancer + database with replica |
In Short
Treat billing as critical infrastructure: verified, idempotent webhooks; central entitlements; careful dunning; correct invoices; and monitoring and backups on every step.
Next Steps
Map every payment event your gateway sends to the action your app takes, build idempotent webhook processing and reconciliation first, and test the full lifecycle in the gateway's test mode before launch.
Bottom Line
Reliable billing protects revenue and customer trust. Keep the setup documented in a short runbook covering where data lives, how to deploy, how to restore from backup and whom to contact, so the system stays maintainable as people and requirements change. Review the setup every quarter with the people who use it, because needs change as the business grows, and small adjustments made early are far cheaper than large changes made under pressure.
SkyRainCloud Plans for This Workload
A subscription SaaS at launch typically runs its app, workers, PostgreSQL and Redis on a 4 vCore / 16 GB server with a 2 vCore / 8 GB staging server; split the database out as subscribers grow.
AMD EPYC 7C13 VPS
Dedicated KVM vCores on AMD EPYC 7C13 (up to 3.70 GHz) with DDR4 ECC memory, NVMe SSD and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| VPS 1 — AMD | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹649/month | Websites, small APIs, bots, staging and VPN servers | Order |
| VPS 2 — AMD | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹1,299/month | WooCommerce, Node.js/Python backends, Docker Compose stacks, CI runners | Order |
| VPS 3 — AMD | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹2,499/month | Production databases, high-traffic sites, multi-container apps | Order |
| VPS 4 — AMD | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹4,899/month | Large production workloads, SaaS platforms, analytics, in-memory caches | Order |
Intel Xeon Platinum 8269CY VPS
KVM VPS on Intel Xeon Platinum 8269CY (up to 3.80 GHz Turbo) with DDR4 ECC memory, NVMe SSD, full root access and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| VPS 1 — Intel | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹649/month | Business websites, small apps, scheduled jobs and bots | Order |
| VPS 2 — Intel | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹1,169/month | Business software, mid-size databases, several sites on one server | Check stock |
| VPS 3 — Intel | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹2,249/month | ERP/CRM stacks, heavier databases, multiple production apps | Check stock |
| VPS 4 — Intel | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹4,299/month | High-memory workloads and consolidated production servers | Check stock |
Prices are monthly in INR as listed on the SkyRainCloud store (verified 2026-11-14). Stock and final pricing are shown on the product page at checkout.
Frequently Asked Questions
What extra infrastructure does a subscription SaaS need?
How do I handle payment webhooks reliably?
What is dunning?
Should I store card details on my server?
What are entitlements?
How do I bill by usage?
Do I need GST invoices?
How do I test billing changes safely?
What server size does a subscription SaaS need?
How do I keep payment flows available during deploys?
Related Guides
- AMD EPYC VPS for SaaS Applications
- How to Host Background Workers and Queue Processing Systems on a VPS
- How to Host a REST API on a VPS Server
- Best VPS Hosting in India for Startups
- How to Set Up Monitoring and Logging for Applications on a VPS
- Cheap VPS for Telegram Bots India: 24/7 Uptime ₹649/mo
- Cheap VPS Hosting India — NVMe SSD & Root Access
- Cheap VPS with Dedicated IPv4 India from ₹649/mo