Skip to main content

Overview

SimpleHost uses Razorpay for payment processing. You can upgrade to the Hobby plan ($5/mo) from the dashboard or directly from the terminal using the API. All billing endpoints require authentication.

Create Checkout

POST /api/billing/checkout
Creates a Razorpay subscription for the Hobby plan and returns a checkout URL. This is the terminal-friendly way to upgrade — call this endpoint and open the returned URL in your browser to complete payment.
curl -X POST https://simplehost.dev/api/billing/checkout \
  -H "Authorization: Bearer sh_live_your_key_here"

Response

{
  "subscriptionId": "sub_abc123...",
  "razorpayKeyId": "rzp_live_...",
  "shortUrl": "https://rzp.io/i/abc123",
  "checkoutUrl": "https://rzp.io/i/abc123"
}
checkoutUrl
string
Open this URL in a browser to complete payment. This is the same as shortUrl.
subscriptionId
string
The Razorpay subscription ID. Used by the dashboard for the embedded checkout popup.
After payment is completed in the browser, your plan upgrades automatically via webhook. There is no need to call any additional endpoint.

Terminal workflow

# 1. Get the checkout URL
CHECKOUT=$(curl -s -X POST https://simplehost.dev/api/billing/checkout \
  -H "Authorization: Bearer sh_live_your_key_here" | jq -r '.checkoutUrl')

# 2. Open it in the browser
open "$CHECKOUT"   # macOS
# xdg-open "$CHECKOUT"  # Linux

# 3. Complete payment in the browser
# Your plan upgrades automatically

Subscription Portal

POST /api/billing/portal
Returns your subscription management info, including a URL to manage your subscription on Razorpay.
curl -X POST https://simplehost.dev/api/billing/portal \
  -H "Authorization: Bearer sh_live_your_key_here"

Response

{
  "portalUrl": "https://rzp.io/i/manage-abc123",
  "status": "active",
  "currentEnd": "2026-04-22T10:00:00.000Z"
}
portalUrl
string
URL to manage your subscription (cancel, update payment method, etc.).
status
string
Current subscription status: "active", "halted", "cancelled", etc.
currentEnd
string | null
ISO 8601 timestamp of when the current billing period ends.

Errors

CodeStatusDescription
UNAUTHORIZED401Missing or invalid API key
INVALID_REQUEST400Already on the Hobby plan (checkout) or no active subscription (portal)
INTERNAL_ERROR500Razorpay API error