Skip to main content

kobana billing plan-changes

Commands of kobana billing plan-changes. Every global option (Global options) applies here.

CommandHTTPDescription
plan-changes configGET /v1/plan_changes/configGet plan change config
plan-changes config updatePATCH /v1/plan_changes/configUpdate plan change config
plan-changes rules listGET /v1/plan_changes/rulesList plan change rules
plan-changes rules createPOST /v1/plan_changes/rulesCreate plan change rule
plan-changes rules getGET /v1/plan_changes/rules/{id}Get plan change rule
plan-changes rules updatePATCH /v1/plan_changes/rules/{id}Update plan change rule
plan-changes rules deleteDELETE /v1/plan_changes/rules/{id}Delete plan change rule
plan-changes statsGET /v1/plan_changes/statsPlan change stats
plan-changes listGET /v1/plan_changesList plan changes
plan-changes createPOST /v1/plan_changesExecute plan change
plan-changes getGET /v1/plan_changes/{id}Get plan change

plan-changes config​

Get plan change config

kobana billing plan-changes config [OPTIONS] [COMMAND]

GET /v1/plan_changes/config

Returns the organization's default configuration for upgrades and downgrades — proration behavior, timing and credit/refund generation.

Responses

HTTPDescription
200Current configuration.
404Resource not found in the current organization.

plan-changes config update​

Update plan change config

kobana billing plan-changes config update [OPTIONS]

PATCH /v1/plan_changes/config

Partially updates (PATCH) the organization's plan change configuration. All fields are optional.

Request body

NameTypeRequiredDescription
allow_upgradebooleannoEnables plan upgrades for the organization.
allow_downgradebooleannoEnables plan downgrades for the organization.
upgrade_prorationstringnoDefault proration method for upgrades: full_proration, no_proration or partial_proration. Values: full_proration, no_proration, partial_proration.
downgrade_prorationstringnoDefault proration method for downgrades. Values: full_proration, no_proration, partial_proration.
upgrade_timingstringnoWhen to apply upgrades: immediate or end_of_period. Values: immediate, end_of_period.
downgrade_timingstringnoWhen to apply downgrades: immediate or end_of_period. Values: immediate, end_of_period.
refund_on_downgradebooleannoRefunds the difference when downgrading.
credit_on_downgradebooleannoGenerates credit (instead of refund) when downgrading.
apply_discount_on_changebooleannoKeeps active discounts when changing plans.

More fields and nested objects: kobana schema billing.plan-changes.config.update.

Responses

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

plan-changes rules list​

List plan change rules

kobana billing plan-changes rules list [OPTIONS]

GET /v1/plan_changes/rules

Lists custom rules that override the default behavior for specific plan-to-plan transitions.

Responses

HTTPDescription
200List of plan change rules.
404Resource not found in the current organization.

plan-changes rules create​

Create plan change rule

kobana billing plan-changes rules create [OPTIONS]

POST /v1/plan_changes/rules

Creates a new rule for a plan-to-plan transition. Lets you block/allow the transition, set timing, proration, discounts and bonus days.

Request body

NameTypeRequiredDescription
from_plan_idstring (uuid)noUUID of the source plan. When omitted, the rule covers any source plan.
to_plan_idstring (uuid)noUUID of the target plan. When omitted, the rule covers any target plan.
change_typestringnoChange type: upgrade, downgrade or lateral. Values: upgrade, downgrade, lateral.
allowedbooleannoWhen false, explicitly blocks the transition.
timingstringnoOverrides the change timing: immediate or end_of_period. Values: immediate, end_of_period.
proration_methodstringnoOverrides the proration method: full_proration, no_proration or partial_proration. Values: full_proration, no_proration, partial_proration.
discount_percentnumbernoPercent discount applied when this rule matches (0 to 100).
bonus_daysintegernoBonus days added to the current period when this rule is applied.
messagestringnoFree-form message shown in the portal/checkout (e.g.: block reason).
priorityintegernoPriority for conflict resolution when multiple rules match (higher wins).

More fields and nested objects: kobana schema billing.plan-changes.rules.create.

Responses

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

plan-changes rules get​

Get plan change rule

kobana billing plan-changes rules get [ID] [OPTIONS]

GET /v1/plan_changes/rules/{id}

Path arguments: id

Responses

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

plan-changes rules update​

Update plan change rule

kobana billing plan-changes rules update [ID] [OPTIONS]

PATCH /v1/plan_changes/rules/{id}

Path arguments: id

Request body

NameTypeRequiredDescription
allowedbooleannoWhen false, explicitly blocks the transition.
timingstringnoOverrides the change timing: immediate or end_of_period. Values: immediate, end_of_period.
proration_methodstringnoOverrides the proration method: full_proration, no_proration or partial_proration. Values: full_proration, no_proration, partial_proration.
discount_percentnumbernoPercent discount applied when this rule matches (0 to 100).
bonus_daysintegernoBonus days added to the current period when this rule is applied.
messagestringnoFree-form message shown in the portal/checkout (e.g.: block reason).
priorityintegernoPriority for conflict resolution when multiple rules match (higher wins).
is_activebooleannoDeactivates the rule without removing it.

More fields and nested objects: kobana schema billing.plan-changes.rules.update.

Responses

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

plan-changes rules delete​

Delete plan change rule

kobana billing plan-changes rules delete [ID] [OPTIONS]

DELETE /v1/plan_changes/rules/{id}

Path arguments: id

Responses

HTTPDescription
200Rule removed.
404Resource not found in the current organization.

plan-changes stats​

Plan change stats

kobana billing plan-changes stats [OPTIONS]

GET /v1/plan_changes/stats

Returns plan change aggregates (totals by type, by status, proration credits and charges) for a window in days.

Query parameters

NameTypeRequiredDescription
daysintegernoWindow in days for the aggregates (default: 30).

Responses

HTTPDescription
200Aggregated plan change stats.
404Resource not found in the current organization.

plan-changes list​

List plan changes

kobana billing plan-changes list [OPTIONS]

GET /v1/plan_changes

Returns the paginated history of plan changes (upgrades, downgrades and lateral) for the current organization.

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).
subscription_idstringnoFilter by changes of a subscription.
billing_account_idstringnoFilter by changes of a billing account.
from_plan_idstringnoFilter by source plan (UUID).
to_plan_idstringnoFilter by target plan (UUID).
change_typestringnoFilter by type: upgrade, downgrade or lateral. Values: upgrade, downgrade, lateral.
statusstringnoFilter by status: pending, scheduled, completed, canceled or failed. Values: pending, scheduled, completed, canceled, failed.
timingstringnoFilter by timing: immediate or end_of_period. Values: immediate, end_of_period.
proration_methodstringnoFilter by proration method (e.g. full_proration, no_proration, partial_proration).
price_difference_minnumber,nullnoMinimum price difference in R$ (sub-cents ÷10000). E.g. 10.50.
price_difference_maxnumber,nullnoMaximum price difference in R$ (sub-cents ÷10000). E.g. 500.00.
proration_charge_minnumber,nullnoMinimum proration charge in R$ (sub-cents ÷10000).
proration_charge_maxnumber,nullnoMaximum proration charge in R$ (sub-cents ÷10000).
proration_credit_minnumber,nullnoMinimum proration credit in R$ (sub-cents ÷10000).
proration_credit_maxnumber,nullnoMaximum proration credit in R$ (sub-cents ÷10000).
effective_date_fromstringnoEffective date from (inclusive). Format: YYYY-MM-DD.
effective_date_tostringnoEffective date to (inclusive). Format: YYYY-MM-DD.
scheduled_date_fromstringnoScheduled date from (inclusive). Format: YYYY-MM-DD.
scheduled_date_tostringnoScheduled date to (inclusive). Format: YYYY-MM-DD.
completed_afterstringnoCompleted from (inclusive). Format: YYYY-MM-DD.
completed_beforestringnoCompleted to (inclusive). Format: YYYY-MM-DD.
created_afterstringnoStart of creation date range (YYYY-MM-DD).
created_beforestringnoEnd of creation date range (YYYY-MM-DD).

Responses

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

plan-changes create​

Execute plan change

kobana billing plan-changes create [OPTIONS]

POST /v1/plan_changes

Executes a plan change for an existing subscription. timing controls whether the change applies immediately (with proration) or at the end of the current period. On success, returns the UUIDs of the plan_change, the proration invoice (if any) and the generated credit (if any).

Request body

NameTypeRequiredDescription
subscription_idstring (uuid)yesUUID of the subscription that will have its plan changed.
to_plan_idstring (uuid)yesUUID of the target plan.
timingstringnoWhen to apply the change: immediate (default for upgrades) or end_of_period (default for downgrades). Values: immediate, end_of_period.
reasonstringnoReason for the change (recorded in the audit log).

More fields and nested objects: kobana schema billing.plan-changes.create.

Responses

HTTPDescription
201Plan change executed.
400Request body failed validation.
404Resource not found in the current organization.
422Request body failed validation.

plan-changes get​

Get plan change

kobana billing plan-changes get [ID] [OPTIONS]

GET /v1/plan_changes/{id}

Path arguments: id

Responses

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