Billing & Subscriptions

Manage your subscription, invoices, and payment methods

Billing Overview

Complete billing management system with subscription control, usage tracking, invoice management, and automated billing cycles.

Subscription Management

Plan upgrades, downgrades, and cancellation

Usage Tracking

Real-time resource usage monitoring

Invoice Management

Detailed invoices with PDF downloads

Quick Actions

Usage Analytics

Track resource usage, costs, and billing metrics in real-time.

GET /billing/usage
Invoice History

Access and download detailed invoices and billing history.

GET /billing/invoices
Payment Methods

Manage saved payment methods and update billing information.

POST /billing/payment-methods

Available Plans

Starter

$29/month

Perfect for small teams and personal projects

10 VPN connections
2 databases
5 hosting sites
10k API calls
Community support
Most Popular

Pro

$79/month

Ideal for growing businesses and teams

50 VPN connections
10 databases
25 hosting sites
100k API calls
Priority support

Enterprise

$199/month

Advanced features for large organizations

Unlimited connections
Unlimited databases
Unlimited hosting
Unlimited API calls
Dedicated support
SSO integration

Usage Metrics

VPN Connections

12 / 50

24% used

Databases

3 / 10

30% used

Hosting Sites

5 / 25

20% used

API Calls

15.2k / 100k

15% used

API Endpoints

GET/billing/subscription
Get current subscription details and usage information

Response

{
  "success": true,
  "subscription": {
    "id": "sub_123",
    "plan": "pro",
    "status": "active",
    "current_period_start": "2024-12-01T00:00:00Z",
    "current_period_end": "2025-01-01T00:00:00Z",
    "cancel_at_period_end": false,
    "trial_end": null
  },
  "usage": {
    "vpn_connections": {
      "current": 12,
      "limit": 50,
      "percentage": 24
    },
    "databases": {
      "current": 3,
      "limit": 10,
      "percentage": 30
    },
    "hosting_sites": {
      "current": 5,
      "limit": 25,
      "percentage": 20
    },
    "api_calls": {
      "current": 15230,
      "limit": 100000,
      "percentage": 15.23
    }
  }
}
PUT/billing/subscription
Update subscription plan or payment settings

Request Body

{
  "plan": "enterprise",
  "payment_method": "pm_456",
  "proration_behavior": "always_invoice"
}
GET/billing/invoices
List all invoices for your organization

Response

{
  "success": true,
  "invoices": [
    {
      "id": "inv_123",
      "number": "INV-2024-001",
      "amount": 99.00,
      "currency": "usd",
      "status": "paid",
      "created": "2024-11-01T00:00:00Z",
      "due_date": "2024-11-15T00:00:00Z",
      "paid_at": "2024-11-02T10:30:00Z",
      "hosted_invoice_url": "https://invoice.vpnenterprise.com/inv_123",
      "pdf_url": "https://files.vpnenterprise.com/inv_123.pdf"
    }
  ],
  "total": 12,
  "has_more": false
}
GET/billing/invoices/:id
Get detailed invoice information

Response

{
  "success": true,
  "invoice": {
    "id": "inv_123",
    "number": "INV-2024-001",
    "amount": 99.00,
    "currency": "usd",
    "status": "paid",
    "line_items": [
      {
        "description": "VPN Enterprise Pro Plan",
        "amount": 79.00,
        "quantity": 1
      },
      {
        "description": "Additional Database (2x)",
        "amount": 20.00,
        "quantity": 2
      }
    ],
    "tax": {
      "amount": 7.92,
      "rate": 8.25,
      "jurisdiction": "US-CA"
    },
    "total": 106.92,
    "created": "2024-11-01T00:00:00Z",
    "paid_at": "2024-11-02T10:30:00Z",
    "payment_method": {
      "type": "card",
      "last4": "4242",
      "brand": "visa"
    }
  }
}
GET/billing/payment-methods
List all saved payment methods

Response

{
  "success": true,
  "payment_methods": [
    {
      "id": "pm_123",
      "type": "card",
      "card": {
        "last4": "4242",
        "brand": "visa",
        "exp_month": 12,
        "exp_year": 2026
      },
      "is_default": true,
      "created": "2024-01-15T10:30:00Z"
    }
  ],
  "default_payment_method": "pm_123"
}
POST/billing/payment-methods
Add a new payment method

Request Body

{
  "payment_method": "pm_new_456",
  "set_as_default": true
}
GET/billing/usage
Get detailed usage statistics and billing metrics

Response

{
  "success": true,
  "current_period": {
    "start": "2024-12-01T00:00:00Z",
    "end": "2025-01-01T00:00:00Z"
  },
  "usage": {
    "vpn": {
      "connections": 12,
      "data_transfer_gb": 245.6,
      "server_hours": 8760
    },
    "database": {
      "instances": 3,
      "storage_gb": 15.2,
      "compute_hours": 2190
    },
    "hosting": {
      "sites": 5,
      "bandwidth_gb": 89.3,
      "build_minutes": 120
    },
    "api": {
      "requests": 15230,
      "rate_limit_hits": 12,
      "webhook_deliveries": 456
    }
  },
  "costs": {
    "base_plan": 79.00,
    "overages": 12.50,
    "add_ons": 8.00,
    "total": 99.50
  }
}
GET/billing/plans
Get available subscription plans and pricing

Response

{
  "success": true,
  "plans": [
    {
      "id": "starter",
      "name": "Starter",
      "price": 29.00,
      "currency": "usd",
      "interval": "month",
      "features": {
        "vpn_connections": 10,
        "databases": 2,
        "hosting_sites": 5,
        "api_calls": 10000,
        "support": "community"
      }
    },
    {
      "id": "pro",
      "name": "Pro",
      "price": 79.00,
      "currency": "usd",
      "interval": "month",
      "features": {
        "vpn_connections": 50,
        "databases": 10,
        "hosting_sites": 25,
        "api_calls": 100000,
        "support": "priority"
      },
      "popular": true
    },
    {
      "id": "enterprise",
      "name": "Enterprise",
      "price": 199.00,
      "currency": "usd",
      "interval": "month",
      "features": {
        "vpn_connections": "unlimited",
        "databases": "unlimited",
        "hosting_sites": "unlimited",
        "api_calls": "unlimited",
        "support": "dedicated",
        "sso": true,
        "advanced_security": true
      }
    }
  ]
}

Billing Best Practices

Monitor Usage Regularly

Set up usage alerts and monitor your resource consumption to avoid unexpected charges and optimize costs.

Plan Changes & Prorations

Understand proration policies when upgrading or downgrading plans. Changes take effect immediately with appropriate billing adjustments.

Payment Method Backup

Keep multiple payment methods on file to prevent service interruptions due to payment failures or expired cards.

Next Steps

Set up webhooks to receive billing events and implement rate limiting for your API usage.