Skip to main content

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.

CommandHTTPDescription
subscriptions listGET /v1/subscriptionsList subscriptions
subscriptions createPOST /v1/subscriptionsCreate a subscription
subscriptions getGET /v1/subscriptions/{id}Get a subscription
subscriptions updatePATCH /v1/subscriptions/{id}Update a subscription
subscriptions deleteDELETE /v1/subscriptions/{id}Cancel and remove a subscription (soft delete)
subscriptions activatePOST /v1/subscriptions/{id}/activateActivate a draft/confirmed subscription
subscriptions cancelPOST /v1/subscriptions/{id}/cancelCancel a subscription
subscriptions change-planPOST /v1/subscriptions/{id}/change-planChange the subscription's plan
subscriptions create-invoicePOST /v1/subscriptions/{id}/create-invoiceGenerate a one-off invoice for the subscription
subscriptions itemsGET /v1/subscriptions/{id}/itemsList the subscription's items
subscriptions pausePOST /v1/subscriptions/{id}/pausePause a subscription
subscriptions resumePOST /v1/subscriptions/{id}/resumeResume a paused subscription
subscriptions revert-to-confirmedPOST /v1/subscriptions/{id}/revert-to-confirmedRevert a subscription to the confirmed state
subscriptions sync-plan-itemsPOST /v1/subscriptions/{id}/sync-plan-itemsRe-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​