Skip to main content

kobana billing subscriptions

Commands of kobana billing subscriptions. Every global option (Global options) applies here.

CommandHTTPDescription
subscriptions itemsGET /v1/subscriptions/{id}/itemsList subscription items
subscriptions items createPOST /v1/subscriptions/{id}/itemsApply changes to the subscription items
subscriptions listGET /v1/subscriptionsList subscriptions
subscriptions createPOST /v1/subscriptionsCreate subscription
subscriptions updatePUT /v1/subscriptionsUpsert subscription
subscriptions getGET /v1/subscriptions/{id}Get subscription
subscriptions deleteDELETE /v1/subscriptions/{id}Cancel and remove subscription (soft delete)
subscriptions activatePOST /v1/subscriptions/{id}/activateActivate draft/confirmed subscription
subscriptions cancelPOST /v1/subscriptions/{id}/cancelCancel subscription
subscriptions change-anniversaryPOST /v1/subscriptions/{id}/change-anniversaryChange the subscription anniversary (cycle start day)
subscriptions change-planPOST /v1/subscriptions/{id}/change-planChange subscription plan
subscriptions create-invoicePOST /v1/subscriptions/{id}/create-invoiceGenerate an ad-hoc invoice for the subscription
subscriptions pausePOST /v1/subscriptions/{id}/pausePause subscription
subscriptions resumePOST /v1/subscriptions/{id}/resumeResume paused subscription
subscriptions revert-to-confirmedPOST /v1/subscriptions/{id}/revert-to-confirmedRevert subscription to confirmed state
subscriptions sync-plan-itemsPOST /v1/subscriptions/{id}/sync-plan-itemsResync items with the current plan

subscriptions items​

List subscription items

kobana billing subscriptions items [ID] [OPTIONS] [COMMAND]

GET /v1/subscriptions/{id}/items

Path arguments: id

Responses

HTTPDescription
200List of items.
404Resource not found in the current organization.

subscriptions items create​

Apply changes to the subscription items

kobana billing subscriptions items create [ID] [OPTIONS]

POST /v1/subscriptions/{id}/items

Runs a batch of up to 50 operations over the items: add, remove, change quantity, swap price or set an ad-hoc unit amount. The operations are applied together and produce a single change record, along with the resulting proration invoice or credit.

Path arguments: id

Request body

NameTypeRequiredDescription
changesarray<oneOf>yesOperations to apply, from 1 to 50. Each item is discriminated by op.
timingstringnoWhen to apply: immediate (default) or end_of_period. Values: immediate, end_of_period.
reasonstringnoFree-form reason, stored alongside the change record.
idempotency_keystringnoIdempotency key. The Idempotency-Key header takes precedence over this field.

More fields and nested objects: kobana schema billing.subscriptions.items.create.

Responses

HTTPDescription
200Changes applied. item_change_id points to the record created; invoice_id and credit_id are filled in when the proration produced an invoice or a credit.
400Request body failed validation.
404Resource not found in the current organization.
422Request body failed validation.

subscriptions list​

List subscriptions

kobana billing subscriptions list [OPTIONS]

GET /v1/subscriptions

Returns a paginated list of the current organization's subscriptions.

Query parameters

NameTypeRequiredDescription
pageintegernoPage (starts at 1). Default: 1.
per_pageintegernoItems per page. Default: 20. Maximum: 100.
sort_bystringnoSort field. Default depends on the resource.
sort_orderstringnoSort direction. Default: desc. Values: asc, desc.
person_idstringnoFilter by associated person UUID.
person_document_numberstringnoFilter by person CPF/CNPJ (exact match).
person_name_containsstringnoFilter by person name (partial search, case-insensitive).
statusstringnoFilter by subscription status. Values: draft, trialing, active, past_due, canceled, paused, suspended.
plan_idstringnoFilter by plan.
billing_cyclestringnoFilter by billing cycle. Values: monthly, quarterly, semiannual, annual.
billing_account_idstringnoFilter by billing account.
searchstringnoFree-text search.
company_idstringnoFilter by company (UUID).
collection_methodstringnoFilter by collection method: charge_automatically, manual_charge or manual_invoice. Values: charge_automatically, manual_charge, manual_invoice.
cancel_at_period_endstringnoFilter subscriptions scheduled to cancel at period end (true) or not (false). Values: true, false.
external_idstringnoFilter by external identifier.
product_group_idstringnoFilter by product group (UUID).
proposal_idstringnoFilter by proposal (UUID).
recurring_amount_minnumber,nullnoMinimum recurring amount in BRL (e.g. 50.00).
recurring_amount_maxnumber,nullnoMaximum recurring amount in BRL (e.g. 500.00).
created_afterstringnoStart of creation date range (YYYY-MM-DD).
created_beforestringnoEnd of creation date range (YYYY-MM-DD).
current_period_start_fromstringnoCurrent period start on or after this date (YYYY-MM-DD).
current_period_start_tostringnoCurrent period start on or before this date (YYYY-MM-DD).
current_period_end_fromstringnoCurrent period end on or after this date (YYYY-MM-DD).
current_period_end_tostringnoCurrent period end on or before this date (YYYY-MM-DD).
trial_end_fromstringnoTrial end on or after this date (YYYY-MM-DD).
trial_end_tostringnoTrial end on or before this date (YYYY-MM-DD).
canceled_afterstringnoCanceled on or after this date (YYYY-MM-DD).
canceled_beforestringnoCanceled on or before this date (YYYY-MM-DD).
activated_afterstringnoActivated on or after this date (YYYY-MM-DD).
activated_beforestringnoActivated on or before this date (YYYY-MM-DD).

Responses

HTTPDescription
200Paginated list of subscriptions.
404Resource not found in the current organization.

subscriptions create​

Create subscription

kobana billing subscriptions create [OPTIONS]

POST /v1/subscriptions

Creates a subscription. Either plan_id or items is required.

Request body

NameTypeRequiredDescription
billing_account_idstring (uuid)yesUUID of the billing account that will receive this subscription.
external_idstringnoIdentifier in your external system, for idempotency/sync.
company_idstring (uuid)no
plan_idstring (uuid)noPlan UUID. Required when items is not provided.
product_group_idstring (uuid)no
billing_cyclestringnoValues: monthly, quarterly, semiannual, annual.
collection_methodstringnoValues: charge_automatically, manual_charge, manual_invoice.
trial_endstring (date-time)noTrial end date (ISO 8601).
trial_period_daysintegernoAlternative to trial_end. Trial days from creation.
proration_behaviorstringnoValues: create_prorations, none, always_invoice.
nfe_issuance_policystringnoValues: disabled, on_finalization, on_full_payment, per_installment.
itemsarray<object>no
commitment_monthsintegernoCommitment (loyalty) period: number of contracted months (copied from the accepted proposal). Inside the commitment window β€” subscription start + months β€” the customer cannot cancel through the portal. Use null to clear.
notesstringno
custom_metadataobjectno

More fields and nested objects: kobana schema billing.subscriptions.create.

Responses

HTTPDescription
201Subscription created.
400Request body failed validation.
404Resource not found in the current organization.
422Request body failed validation.

subscriptions update​

Upsert subscription

kobana billing subscriptions update [OPTIONS]

PUT /v1/subscriptions

Takes the same body as POST, plus id and public_id, and dedups on id, public_id, external_id and the resource's natural keys, in that order, stopping at the first key that finds a record. A match is updated and returns 200; otherwise the record is created and returns 201. The POST's required fields are required only when no record is found, and updates are partial: absent fields keep their stored value.

Request body

NameTypeRequiredDescription
billing_account_idstring (uuid)noUUID of the billing account that will receive this subscription.
external_idstringnoIdentifier in your external system, for idempotency/sync.
company_idstring (uuid)no
plan_idstring (uuid)noPlan UUID. Required when items is not provided.
product_group_idstring (uuid)no
billing_cyclestringnoValues: monthly, quarterly, semiannual, annual.
collection_methodstringnoValues: charge_automatically, manual_charge, manual_invoice.
trial_endstring (date-time)noTrial end date (ISO 8601).
trial_period_daysintegernoAlternative to trial_end. Trial days from creation.
proration_behaviorstringnoValues: create_prorations, none, always_invoice.
nfe_issuance_policystringnoValues: disabled, on_finalization, on_full_payment, per_installment.
itemsarray<object>no
commitment_monthsintegernoCommitment (loyalty) period: number of contracted months (copied from the accepted proposal). Inside the commitment window β€” subscription start + months β€” the customer cannot cancel through the portal. Use null to clear.
notesstringno
custom_metadataobjectno
idstring (uuid)noRecord UUID. Used only to locate it β€” never written.
public_idstring (uuid)noPublic UUID of the record, used to locate it.

More fields and nested objects: kobana schema billing.subscriptions.update.

Responses

HTTPDescription
200Record updated.
201Record created.
400Request body failed validation.
404Resource not found in the current organization.
422Request body failed validation.

subscriptions get​

Get subscription

kobana billing subscriptions get [ID] [OPTIONS]

GET /v1/subscriptions/{id}

Path arguments: id

Responses

HTTPDescription
200Subscription detail.
404Resource not found in the current organization.

subscriptions delete​

Cancel and remove subscription (soft delete)

kobana billing subscriptions delete [ID] [OPTIONS]

DELETE /v1/subscriptions/{id}

Path arguments: id

Responses

HTTPDescription
200Soft delete confirmation.
404Resource not found in the current organization.

subscriptions activate​

Activate draft/confirmed subscription

kobana billing subscriptions activate [ID] [OPTIONS]

POST /v1/subscriptions/{id}/activate

Path arguments: id

Responses

HTTPDescription
200Subscription activated.
404Resource not found in the current organization.

subscriptions cancel​

Cancel subscription

kobana billing subscriptions cancel [ID] [OPTIONS]

POST /v1/subscriptions/{id}/cancel

Cancels immediately, or schedules for end of period when cancel_at_period_end=true.

Path arguments: id

Request body

NameTypeRequiredDescription
cancel_at_period_endbooleannoWhen true, schedules cancellation for end of current period. Default: false (cancels immediately).
reasonstringno

More fields and nested objects: kobana schema billing.subscriptions.cancel.

Responses

HTTPDescription
200Subscription canceled.
404Resource not found in the current organization.

subscriptions change-anniversary​

Change the subscription anniversary (cycle start day)

kobana billing subscriptions change-anniversary [ID] [OPTIONS]

POST /v1/subscriptions/{id}/change-anniversary

Moves the day of the month on which cycles start. The cycle in progress keeps its start and is extended to the day before the new day; the added days are billed pro rata (cycle amount Γ— days Γ· cycle days) in a subscription_update invoice. The change always moves the date forward, never back. Use dry_run to compute without applying.

Path arguments: id

Request body

NameTypeRequiredDescription
anniversary_dayintegeryesNew day of the month (1 to 28) on which cycles start. Use 1 for calendar months.
charge_prorationbooleannoBill the added days. Default: true, unless the subscription proration_behavior is none.
dry_runbooleannoWhen true, only computes and returns the result, changing nothing.
reasonstringnoChange reason (optional, recorded in audit log).

More fields and nested objects: kobana schema billing.subscriptions.change-anniversary.

Responses

HTTPDescription
200Change result (or the simulation, with dry_run).
404Resource not found in the current organization.
422Request body failed validation.

subscriptions change-plan​

Change subscription plan

kobana billing subscriptions change-plan [ID] [OPTIONS]

POST /v1/subscriptions/{id}/change-plan

Upgrade or downgrade. Proration follows the subscription's proration_behavior.

Path arguments: id

Request body

NameTypeRequiredDescription
plan_idstring (uuid)yesUUID of the new plan.
timingstringnoWhen the plan change takes effect. Default: immediate. Values: immediate, end_of_period.
reasonstringnoChange reason (optional, recorded in audit log).

More fields and nested objects: kobana schema billing.subscriptions.change-plan.

Responses

HTTPDescription
200Subscription updated.
404Resource not found in the current organization.
422Request body failed validation.

subscriptions create-invoice​

Generate an ad-hoc invoice for the subscription

kobana billing subscriptions create-invoice [ID] [OPTIONS]

POST /v1/subscriptions/{id}/create-invoice

Path arguments: id

Responses

HTTPDescription
201Invoice generated.
404Resource not found in the current organization.

subscriptions pause​

Pause subscription

kobana billing subscriptions pause [ID] [OPTIONS]

POST /v1/subscriptions/{id}/pause

Suspends charging while keeping the subscription open. behavior controls how invoices generated during the pause are handled.

Path arguments: id

Request body

NameTypeRequiredDescription
behaviorstringnoHow to treat invoices generated during the pause. Default: mark_uncollectible. Values: mark_uncollectible, keep_as_draft, void.
resumes_atstring (date-time)noAuto-resume date. Omit for manual resume.

More fields and nested objects: kobana schema billing.subscriptions.pause.

Responses

HTTPDescription
200Subscription paused.
404Resource not found in the current organization.
422Request body failed validation.

subscriptions resume​

Resume paused subscription

kobana billing subscriptions resume [ID] [OPTIONS]

POST /v1/subscriptions/{id}/resume

Path arguments: id

Responses

HTTPDescription
200Subscription resumed.
404Resource not found in the current organization.

subscriptions revert-to-confirmed​

Revert subscription to confirmed state

kobana billing subscriptions revert-to-confirmed [ID] [OPTIONS]

POST /v1/subscriptions/{id}/revert-to-confirmed

Path arguments: id

Responses

HTTPDescription
200Subscription reverted.
404Resource not found in the current organization.

subscriptions sync-plan-items​

Resync items with the current plan

kobana billing subscriptions sync-plan-items [ID] [OPTIONS]

POST /v1/subscriptions/{id}/sync-plan-items

Realigns subscription items with the plan-items template (manual reconciliation).

Path arguments: id

Responses

HTTPDescription
200Subscription synced.
404Resource not found in the current organization.