Skip to main content
Create and manage recurring subscriptions with products, prices, and billing cycles.

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

curl -X POST https://api.atlas.co/functions/v1/products \
  -H "Authorization: Bearer sk_test_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Pro Plan",
    "description": "Full access to all features",
    "metadata": { "tier": "pro" }
  }'
Parameters:
ParameterTypeRequiredDescription
namestringYesProduct name displayed to customers
descriptionstringNoOptional product description
metadataobjectNoKey-value pairs for your use

List Products

curl https://api.atlas.co/functions/v1/products \
  -H "Authorization: Bearer sk_test_xxx"

Prices

Prices define how much to charge for a product.

Create Price

curl -X POST https://api.atlas.co/functions/v1/prices \
  -H "Authorization: Bearer sk_test_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "product": "prod_xxx",
    "currency": "usd",
    "unit_amount": 2999,
    "type": "recurring",
    "recurring": {
      "interval": "month"
    }
  }'
Parameters:
ParameterTypeRequiredDescription
productstringYesProduct ID to attach price to
currencystringYes3-letter ISO currency code (e.g. usd)
unit_amountintegerNoAmount in cents (e.g. 2999 = $29.99)
typestringNoone_time or recurring (default: one_time)
recurring.intervalstringNoday, week, month, or year
recurring.interval_countintegerNoNumber of intervals (default: 1)
recurring.usage_typestringNolicensed or metered

Subscriptions

Create Subscription

curl -X POST https://api.atlas.co/functions/v1/subscriptions \
  -H "Authorization: Bearer sk_test_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "customer": "cus_xxx",
    "items": [
      { "price": "price_xxx", "quantity": 1 }
    ],
    "trial_period_days": 14
  }'
Parameters:
ParameterTypeRequiredDescription
customerstringYesCustomer ID
itemsarrayYesArray of price objects with quantity
trial_period_daysintegerNoFree trial days before billing
cancel_at_period_endbooleanNoCancel at end of current period
metadataobjectNoKey-value pairs for your use

Pause Subscription

curl -X POST https://api.atlas.co/functions/v1/subscriptions/sub_xxx/pause \
  -H "Authorization: Bearer sk_test_xxx"

Resume Subscription

curl -X POST https://api.atlas.co/functions/v1/subscriptions/sub_xxx/resume \
  -H "Authorization: Bearer sk_test_xxx"

Subscription Statuses

StatusDescription
trialingCustomer is in free trial period
activeSubscription is active and billing
past_duePayment failed, retrying
pausedSubscription paused by request
canceledSubscription has been canceled
unpaidAll retries exhausted, not canceled

Usage Records (Metered Billing)

Report usage for metered subscription items.
curl -X POST https://api.atlas.co/functions/v1/usage-records \
  -H "Authorization: Bearer sk_test_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "subscription_item": "si_xxx",
    "quantity": 150,
    "action": "increment"
  }'
Parameters:
ParameterTypeRequiredDescription
subscription_itemstringYesSubscription item ID
quantityintegerYesUsage quantity to record
actionstringNoincrement or set (default: increment)
timestampintegerNoUnix timestamp (default: now)

Coupons

Create discount coupons for subscriptions.
curl -X POST https://api.atlas.co/functions/v1/coupons \
  -H "Authorization: Bearer sk_test_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "SAVE20",
    "percent_off": 20,
    "duration": "repeating",
    "duration_in_months": 3
  }'
Parameters:
ParameterTypeRequiredDescription
durationstringYesonce, repeating, or forever
percent_offnumberNoPercentage discount (0-100)
amount_offintegerNoFixed amount off in cents
currencystringNoRequired if using amount_off
duration_in_monthsintegerNoRequired if duration is repeating
max_redemptionsintegerNoMax times coupon can be used
redeem_byintegerNoUnix timestamp when coupon expires