Overview
Build advanced billing logic with products, recurring prices, trials, usage-based billing, and automatic invoicing. Stripe-compatible API design.Products
Products represent the goods or services you sell.Create Product
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Product name displayed to customers |
description | string | No | Optional product description |
metadata | object | No | Key-value pairs for your use |
List Products
Prices
Prices define how much to charge for a product.Create Price
| Parameter | Type | Required | Description |
|---|---|---|---|
product | string | Yes | Product ID to attach price to |
currency | string | Yes | 3-letter ISO currency code (e.g. usd) |
unit_amount | integer | No | Amount in cents (e.g. 2999 = $29.99) |
type | string | No | one_time or recurring (default: one_time) |
recurring.interval | string | No | day, week, month, or year |
recurring.interval_count | integer | No | Number of intervals (default: 1) |
recurring.usage_type | string | No | licensed or metered |
Subscriptions
Create Subscription
| Parameter | Type | Required | Description |
|---|---|---|---|
customer | string | Yes | Customer ID |
items | array | Yes | Array of price objects with quantity |
trial_period_days | integer | No | Free trial days before billing |
cancel_at_period_end | boolean | No | Cancel at end of current period |
metadata | object | No | Key-value pairs for your use |
Pause Subscription
Resume Subscription
Subscription Statuses
| Status | Description |
|---|---|
trialing | Customer is in free trial period |
active | Subscription is active and billing |
past_due | Payment failed, retrying |
paused | Subscription paused by request |
canceled | Subscription has been canceled |
unpaid | All retries exhausted, not canceled |
Usage Records (Metered Billing)
Report usage for metered subscription items.| Parameter | Type | Required | Description |
|---|---|---|---|
subscription_item | string | Yes | Subscription item ID |
quantity | integer | Yes | Usage quantity to record |
action | string | No | increment or set (default: increment) |
timestamp | integer | No | Unix timestamp (default: now) |
Coupons
Create discount coupons for subscriptions.| Parameter | Type | Required | Description |
|---|---|---|---|
duration | string | Yes | once, repeating, or forever |
percent_off | number | No | Percentage discount (0-100) |
amount_off | integer | No | Fixed amount off in cents |
currency | string | No | Required if using amount_off |
duration_in_months | integer | No | Required if duration is repeating |
max_redemptions | integer | No | Max times coupon can be used |
redeem_by | integer | No | Unix timestamp when coupon expires |