billing

Preview a subscription change

[cloud-only] Returns a preview of what a subscription change would cost, including prorations.

post/api/billing/preview-subscribe

Request body

plan_idstring required

ID of the plan to preview

Response

Subscription preview

allowedboolean required

Whether this subscription change is allowed

reasonstring

Reason why the change is not allowed (only present if allowed=false)

transition_type'new_subscription' | 'upgrade' | 'downgrade' | 'duration_change' required

Type of subscription transition

effective_atstring date-time required

When the change takes effect

is_immediateboolean required

Whether the change takes effect immediately (true) or at period end (false)

cost_today_centsinteger required

Amount to charge today in cents (0 for downgrades)

cost_next_period_centsinteger required

Amount that will be charged at next billing period in cents

credits_today_centsinteger required

Credits granted today in cents (prorated for mid-period upgrades)

credits_next_period_centsinteger required

Credits that will be granted at next billing period in cents

Example response

{
  "cost_today_cents": 5000,
  "cost_next_period_cents": 10000,
  "credits_today_cents": 5000,
  "credits_next_period_cents": 10000,
  "current_plan": {
    "slug": "team-pro-monthly",
    "price_cents": 10000,
    "credits_cents": 10000,
    "seat_summary": {
      "seat_count": 5,
      "total_cost_cents": 50000,
      "total_credits_cents": 50000
    }
  },
  "new_plan": {
    "slug": "team-pro-monthly",
    "price_cents": 10000,
    "credits_cents": 10000,
    "seat_summary": {
      "seat_count": 5,
      "total_cost_cents": 50000,
      "total_credits_cents": 50000
    }
  }
}

Changes