Skip to main content

Plans and subscriptions

Use Billing plans to define what a customer can buy, then assign a billing customer to an active plan. A billing customer is created from an app organization, so the usual flow starts with organizations.

Create billing customers from organizations

Before assigning a subscription, map organizations into Billing:

  1. Open the app.
  2. Open Services > Billing.
  3. Review the Customers panel.
  4. Select Sync tenants.
  5. Confirm each intended organization appears as a billing customer.

The UI uses the product word Organizations. The API path still uses tenants because that is the launch API contract.

Create a plan

Switera Billing plan catalog panel with an active Launch Plan
Plans can be active, draft, or archived. Active plans can be assigned to billing customers.
  1. Open Services > Billing.
  2. In Plan catalog, select New plan.
  3. Enter a stable plan name and code.
  4. Set price, currency, and interval.
  5. Choose whether the plan is usage-based.
  6. Keep the plan as Draft while reviewing it.
  7. Change the status to Active when it is ready for customer assignment.

Use short, stable plan codes. Do not encode customer names, temporary pricing discussions, or private contract details in the code.

Assign a customer

Switera Billing customer assignment panel with a trialing customer subscription
Assignments show lifecycle hints so Builders know whether a trial, renewal, cancellation, or missing period needs attention.
  1. Confirm the customer mapping exists.
  2. Confirm an active plan exists.
  3. In Customer assignments, select New assignment.
  4. Choose the customer.
  5. Choose the active plan.
  6. Select a status such as Trialing or Active.
  7. Add period dates when you need renewal or trial guidance.
  8. Save the assignment.

Only one current assignment can exist for the same billing customer. Cancel or update the current assignment before creating a replacement.

Lifecycle states

StateMeaningBuilder action
trialingThe customer is in a trial window.Confirm trial end date and conversion plan.
activeThe customer has an active assignment.Monitor usage and invoices.
past_duePayment or period state needs attention.Review invoice and customer follow-up.
incompleteThe assignment is not ready for live billing.Complete missing plan, period, or payment setup.
canceledThe assignment was ended without deleting history.Keep for audit and historical context.

API examples

Sync billing customers from organizations:

curl -X POST "https://switera.com/api/v1/apps/$APP_ID/billing/customers/sync-tenants" \
-H "Authorization: Bearer $SWITERA_SECRET_KEY"

Create an active monthly plan:

curl -X POST "https://switera.com/api/v1/apps/$APP_ID/billing/plans" \
-H "Authorization: Bearer $SWITERA_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"code": "launch",
"name": "Launch",
"description": "Launch plan for early customers.",
"currency": "usd",
"billing_interval": "monthly",
"amount_cents": 4900,
"usage_based": true,
"status": "active"
}'

Assign a customer to a plan:

curl -X POST "https://switera.com/api/v1/apps/$APP_ID/billing/subscriptions" \
-H "Authorization: Bearer $SWITERA_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"billing_customer_id": "$BILLING_CUSTOMER_ID",
"plan_id": "$PLAN_ID",
"status": "trialing",
"current_period_start": "2026-07-03T00:00:00Z",
"current_period_end": "2026-08-02T00:00:00Z",
"trial_ends_at": "2026-08-02T00:00:00Z"
}'

Troubleshooting

SymptomLikely causeFix
No customers are availableOrganizations were not synced into Billing.Select Sync tenants or call the sync API.
Plan cannot be assignedThe plan is still draft or archived.Update the plan to active.
Assignment says no action needed but customer should convert soonPeriod or trial dates are missing or wrong.Edit the assignment dates.
Duplicate assignment errorThe billing customer already has a current assignment.Update or cancel the current assignment first.

Related pages: