Subscriptions
The live contract between a customer and a plan: activate, pause, resume, change plan and cancel. create-invoice forces an invoice outside the cycle.
| Command | HTTP | Description |
|---|---|---|
subscriptions list | GET /v1/subscriptions | List subscriptions |
subscriptions create | POST /v1/subscriptions | Create a subscription |
subscriptions get | GET /v1/subscriptions/{id} | Get a subscription |
subscriptions update | PATCH /v1/subscriptions/{id} | Update a subscription |
subscriptions delete | DELETE /v1/subscriptions/{id} | Cancel and remove a subscription (soft delete) |
subscriptions activate | POST /v1/subscriptions/{id}/activate | Activate a draft/confirmed subscription |
subscriptions cancel | POST /v1/subscriptions/{id}/cancel | Cancel a subscription |
subscriptions change-plan | POST /v1/subscriptions/{id}/change-plan | Change the subscription's plan |
subscriptions create-invoice | POST /v1/subscriptions/{id}/create-invoice | Generate a one-off invoice for the subscription |
subscriptions items | GET /v1/subscriptions/{id}/items | List the subscription's items |
subscriptions pause | POST /v1/subscriptions/{id}/pause | Pause a subscription |
subscriptions resume | POST /v1/subscriptions/{id}/resume | Resume a paused subscription |
subscriptions revert-to-confirmed | POST /v1/subscriptions/{id}/revert-to-confirmed | Revert a subscription to the confirmed state |
subscriptions sync-plan-items | POST /v1/subscriptions/{id}/sync-plan-items | Re-sync items with the current plan |
Examples
--params carries query and path parameters (id, page, filters); --json carries the request body; --fields limits which fields come back — worth using on every list/get to save context. See Global flags for the full reference.
# List subscriptions
kobana billing subscriptions list \
--fields "id,public_id,external_id,billing_account_id,company_id"
# Get a subscription
kobana billing subscriptions get --params '{"id": "SUBSCRIPTION_ID"}'
# Create a subscription
kobana billing subscriptions create \
--json '{"billing_account_id": "BILLING_ACCOUNT_ID"}'
# Update a subscription
kobana billing subscriptions update \
--params '{"id": "SUBSCRIPTION_ID"}' \
--json '{"external_id": "EXTERNAL_ID", "plan_id": "PLAN_ID", "billing_cycle": "monthly"}'
# Activate a draft/confirmed subscription
kobana billing subscriptions activate --params '{"id": "SUBSCRIPTION_ID"}'
# Cancel and remove a subscription (soft delete)
kobana billing subscriptions delete \
--params '{"id": "SUBSCRIPTION_ID"}' \
--dry-run
Next steps
- Subscription changes
- Schema introspection — every parameter this resource accepts.