v1
credits

Update subscription tier or start a Stripe Checkout session

Changed on
post/api/credits/subscription

Request

  • The document declares no server URL.
  • Auth
    HTTP bearer

Request body

tier'NO_TIER' | 'BASIC' | 'PRO' | 'MAX' | 'BUSINESS' required
success_urlstring
cancel_urlstring
billing_cycle'monthly' | 'yearly'
proration_dateinteger nullable
preview_idstring nullable
surface'onboarding' | 'paywall_gate' | 'billing' nullable

Where the plan was picked; analytics only.

Response

Successful Response

tier'NO_TIER' | 'TRIAL' | 'BASIC' | 'PRO' | 'MAX' | 'BUSINESS' | 'ENTERPRISE' required
monthly_costinteger required
tier_costsobject required
tier_costs_yearlyobject

Tier → yearly amount in cents. Populated only for tiers with a yearly Stripe price configured in LaunchDarkly. Empty for monthly-only configurations.

billing_cycle'monthly' | 'yearly'

Billing cycle of the user's active Stripe subscription. Defaults to monthly for users without an active sub. monthly_cost above reflects this cycle's actual price (so a yearly subscriber sees their yearly amount, not the monthly equivalent).

tier_multipliersobject

Tier → rate-limit multiplier. Covers the same tiers listed in tier_costs so the frontend can render rate-limit badges relative to the lowest visible tier without knowing backend defaults.

proration_credit_centsinteger required
has_active_stripe_subscriptionboolean

True when the user has an active/trialing Stripe subscription. The frontend uses this to branch upgrade UX: modify-in-place + saved-card auto-charge when True, redirect to Stripe Checkout when False.

current_period_endinteger nullable

Unix timestamp of the active subscription's current_period_end. Used to show the date Stripe will issue the next invoice (with prorated upgrade charges, if any). None when no active sub.

paused_workflow_schedulesinteger

Active workflow schedules that won't run until the user has a plan. Counted only for NO_TIER; 0 for every other tier.

pending_tier'NO_TIER' | 'BASIC' | 'PRO' | 'MAX' | 'BUSINESS' nullable
pending_tier_effective_atstring date-time nullable
pending_billing_cycle'monthly' | 'yearly' nullable

Billing cycle of the queued change, when resolvable. Set alongside pending_tier for tier downgrades and same-tier cycle switches (yearly→monthly). The frontend uses this to differentiate a cycle-only schedule (pending_tier == current tier) from a real tier downgrade so the UI copy can describe the actual change. None for cancellations and unconfigured legacy prices.

urlstring

Populated only when POST /credits/subscription starts a Stripe Checkout Session (BASIC → paid upgrade), or when a trial ending early needs the customer's bank to confirm its payment, on Stripe's invoice page. Empty string in all other branches — the client sends the customer to this URL when non-empty.

Changes

    • info

      added the optional property to the response with the status

    • info

      added the new optional request property

    • info

      added the new optional request property