---
title: "usePlanChange"
description: "usePlanChange, auto-imported in the app: its options, return value and types."
canonical_url: "https://nuxt-backend.dev/docs/reference/api/use-plan-change"
---
# usePlanChange

Version: nuxt-backend 0.6.x · Tab: Reference · Kind: reference · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

## Interfaces

### PlanChangeTarget

Defined in: [src/runtime/vue/composables/use-plan-change.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts)

A price a subscription's switch moves to, as its confirmation names it.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="productid">
        
      </a>
      
       <code>
        productId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The product to switch to: one price of a plan.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="plan">
        
      </a>
      
       <code>
        plan
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The plan as the confirmation names it: <code>
        Team
      </code>
      
      , <code>
        Pro, billed yearly
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="price">
        
      </a>
      
       <code>
        price
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Its price with its period, formatted: <code>
        $29/mo
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="key">
        
      </a>
      
       <code>
        key?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Who opened the confirmation, to tell two openers apart: a plan card's key. Default: <code>
        productId
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### PlanSwitchTarget

Defined in: [src/runtime/vue/composables/use-plan-change.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts)

One price the subscription can switch to, in its own currency ([UsePlanChangeReturn.targets](#targets)).

#### Extends

- `Required`<[`PlanChangeTarget`](#planchangetarget)>

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Overrides
    </th>
    
    <th>
      Inherited from
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="productid-1">
        
      </a>
      
       <code>
        productId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The product to switch to: one price of a plan.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="#planchangetarget">
        <code>
          PlanChangeTarget
        </code>
      </a>
      
      .<a href="#productid">
        <code>
          productId
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="plan-1">
        
      </a>
      
       <code>
        plan
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The plan as the confirmation names it: <code>
        Team
      </code>
      
      , <code>
        Pro, billed yearly
      </code>
      
      .
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="#planchangetarget">
        <code>
          PlanChangeTarget
        </code>
      </a>
      
      .<a href="#plan">
        <code>
          plan
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="price-1">
        
      </a>
      
       <code>
        price
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Its price with its period, formatted: <code>
        $29/mo
      </code>
      
      .
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="#planchangetarget">
        <code>
          PlanChangeTarget
        </code>
      </a>
      
      .<a href="#price">
        <code>
          price
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="key-1">
        
      </a>
      
       <code>
        key
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Its plan's catalog key (<code>
        'team'
      </code>
      
      ).
    </td>
    
    <td>
      <a href="#planchangetarget">
        <code>
          PlanChangeTarget
        </code>
      </a>
      
      .<a href="#key">
        <code>
          key
        </code>
      </a>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="name">
        
      </a>
      
       <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The plan's own name, as the provider lists it.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="interval">
        
      </a>
      
       <code>
        interval
      </code>
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/billing#cataloginterval">
        <code>
          CatalogInterval
        </code>
      </a>
    </td>
    
    <td>
      The interval the price bills at.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="amount">
        
      </a>
      
       <code>
        amount
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      What one interval costs, in the currency's smallest unit.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="currency">
        
      </a>
      
       <code>
        currency
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Lower-case ISO 4217 code: the subscription's own, where it is known.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### UsePlanChangeOptions

Defined in: [src/runtime/vue/composables/use-plan-change.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts)

Options for [usePlanChange](#useplanchange).

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="labels">
        
      </a>
      
       <code>
        labels?
      </code>
    </td>
    
    <td>
      <code>
        MaybeRefOrGetter
      </code>
      
      < | <a href="https://nuxt-backend.dev/docs/reference/api/use-labels#labeloverrides">
        <code>
          LabelOverrides
        </code>
      </a>
      
      <{ <code>
        title
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        emailNotice
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        emailOptOut
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        description
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        period
      </code>
      
      : { <code>
        month
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        year
      </code>
      
      : <code>
        string
      </code>
      
      ; }; <code>
        interval
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        intervals
      </code>
      
      : { <code>
        month
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        year
      </code>
      
      : <code>
        string
      </code>
      
      ; }; <code>
        save
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        loading
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        empty
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        soon
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        credits
      </code>
      
      : { <code>
        month
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        year
      </code>
      
      : <code>
        string
      </code>
      
      ; }; <code>
        welcome
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        retired
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        packCredits
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        perCredit
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        lessPerCredit
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        bestValue
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        promotion
      </code>
      
      : { <code>
        once
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        months
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        forever
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        pack
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        ends
      </code>
      
      : <code>
        string
      </code>
      
      ; }; <code>
        contact
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscribe
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        switch
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        upgrade
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        downgrade
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        switchInterval
      </code>
      
      : { <code>
        month
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        year
      </code>
      
      : <code>
        string
      </code>
      
      ; }; <code>
        scheduled
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        cancel
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        uncancel
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        trial
      </code>
      
      : { <code>
        day
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        week
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        month
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        year
      </code>
      
      : <code>
        string
      </code>
      
      ; }; <code>
        current
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        signIn
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        signInFree
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        returnsToFree
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        topUp
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        portal
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        checkingOut
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        changing
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        canceling
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        uncanceling
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        openingPortal
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        managed
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        finishingPurchase
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        confirmTitle
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        confirmEnds
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        confirmEndsPeriod
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        confirmCancel
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        changeTitle
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        billedAt
      </code>
      
      : { <code>
        month
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        year
      </code>
      
      : <code>
        string
      </code>
      
      ; }; <code>
        changeNow
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        changeLater
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        changeLaterPeriod
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        changeTrial
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        changeTrialEnds
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        changeTrialLater
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        changeGifted
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        confirmChange
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        switchingPlan
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        keepCurrent
      </code>
      
      : <code>
        string
      </code>
      
      ; }> | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      Copy for the confirmation, over <code>
        appConfig.backend.labels.pricing
      </code>
      
       and the translations.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="pricing">
        
      </a>
      
       <code>
        pricing?
      </code>
    </td>
    
    <td>
      <code>
        Pick
      </code>
      
      <<a href="https://nuxt-backend.dev/docs/reference/api/use-pricing#usepricingreturn">
        <code>
          UsePricingReturn
        </code>
      </a>
      
      , <code>
        "plans"
      </code>
      
       | <code>
        "currency"
      </code>
      
      > & <code>
        Partial
      </code>
      
      <<code>
        Pick
      </code>
      
      <<a href="https://nuxt-backend.dev/docs/reference/api/use-pricing#usepricingreturn">
        <code>
          UsePricingReturn
        </code>
      </a>
      
      , <code>
        "currencies"
      </code>
      
       | <code>
        "error"
      </code>
      
      >>
    </td>
    
    <td>
      The pricing your page reads already (<code>
        usePricing()
      </code>
      
      ): its prices stand for the switch's wherever they are in the subscription's currency, so no second pricing is read for a page in it. A page in another currency still reads the subscription's. Its <code>
        currencies
      </code>
      
       and <code>
        error
      </code>
      
       count too where it has them: a gifted plan's checkout pays in the currency its card shows where the catalog prices more than one, and a failed read ends the wait.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="enabled">
        
      </a>
      
       <code>
        enabled?
      </code>
    </td>
    
    <td>
      <code>
        MaybeRefOrGetter
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      While this is <code>
        false
      </code>
      
       no pricing is read for the switch, and nothing is a target (default <code>
        true
      </code>
      
      ).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### UsePlanChangeReturn

Defined in: [src/runtime/vue/composables/use-plan-change.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts)

What [usePlanChange](#useplanchange) returns.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="targets">
        
      </a>
      
       <code>
        targets
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<a href="#planswitchtarget">
        <code>
          PlanSwitchTarget
        </code>
      </a>
      
      <span>
        
      </span>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      Every price the subscription can switch to: each plan on sale at each interval in the subscription's own currency, which the provider keeps on a switch, the plan's own other period included. Never the price it is on, the free plan, a retired plan, an archived price, the price a scheduled change moves to (<code>
        scheduledFor
      </code>
      
      ), nor one with no price in that currency, which the provider would refuse. For a gifted plan's holder, whose switch is a checkout, every paid plan's price as the pricing shows it. <code>
        []
      </code>
      
       without a plan to switch from (none, the free plan, still loading); <code>
        undefined
      </code>
      
       while the prices are read.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="targetfor">
        
      </a>
      
       <code>
        targetFor
      </code>
    </td>
    
    <td>
      (<code>
        key
      </code>
      
      , <code>
        interval
      </code>
      
      ) => <a href="#planswitchtarget">
        <code>
          PlanSwitchTarget
        </code>
      </a>
      
       | <code>
        null
      </code>
      
       | <code>
        undefined
      </code>
    </td>
    
    <td>
      The target for one plan's card: the price of the plan <code>
        key
      </code>
      
       at <code>
        interval
      </code>
      
      , as <code>
        targets
      </code>
      
       lists it. <code>
        null
      </code>
      
       while its price in the subscription's currency is read; <code>
        undefined
      </code>
      
       when there is no switch to it, which a card shows no switch button for.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="scheduledfor">
        
      </a>
      
       <code>
        scheduledFor
      </code>
    </td>
    
    <td>
      (<code>
        productId
      </code>
      
      ) => <code>
        Date
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      When a change scheduled for the period's end moves the subscription to <code>
        productId
      </code>
      
      , else <code>
        null
      </code>
      
      : say when, rather than offer it again.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="target">
        
      </a>
      
       <code>
        target
      </code>
    </td>
    
    <td>
      <code>
        Ref
      </code>
      
      <<code>
        Required
      </code>
      
      <<a href="#planchangetarget">
        <code>
          PlanChangeTarget
        </code>
      </a>
      
      > | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      The switch waiting on the person's confirmation, <code>
        null
      </code>
      
       while none is open.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="preview">
        
      </a>
      
       <code>
        preview
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<a href="https://nuxt-backend.dev/docs/reference/api/use-billing#planchangepreview">
        <code>
          PlanChangePreview
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      What that switch would do (<code>
        useBilling().changeOf
      </code>
      
      ); <code>
        null
      </code>
      
       while none is open, for a gifted plan's, and for one there is nothing to preview.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="applies">
        
      </a>
      
       <code>
        applies
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<a href="#planchangeapplies">
        <code>
          PlanChangeApplies
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      How that switch goes; <code>
        null
      </code>
      
       while none is open, or for one there is nothing to say about.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="title">
        
      </a>
      
       <code>
        title
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        string
      </code>
      
      >
    </td>
    
    <td>
      The confirmation's question, "Switch to Team?"; <code>
        ''
      </code>
      
       while none is open.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="when">
        
      </a>
      
       <code>
        when
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        string
      </code>
      
      >
    </td>
    
    <td>
      When the switch happens and how the period's difference is settled, in the reader's words: at once with the difference settled now, when the paid year runs out, and in a trial, whether it carries over, ends with a first payment, or waits for its end; for a gifted plan's holder, that the checkout ends the gift. What the switch <code>
        confirm
      </code>
      
       makes does. <code>
        ''
      </code>
      
       while none is open.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="open">
        
      </a>
      
       <code>
        open
      </code>
    </td>
    
    <td>
      (<code>
        target
      </code>
      
      ) => <code>
        void
      </code>
    </td>
    
    <td>
      Ask about a switch: <code>
        target
      </code>
      
      , <code>
        preview
      </code>
      
       and the words follow it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="close">
        
      </a>
      
       <code>
        close
      </code>
    </td>
    
    <td>
      () => <code>
        void
      </code>
    </td>
    
    <td>
      Close the confirmation without switching.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="confirm">
        
      </a>
      
       <code>
        confirm
      </code>
    </td>
    
    <td>
      (<code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Make the switch the confirmation is open for, then close it: a subscriber's <code>
        changePlan(productId, { proration: 'invoice' })
      </code>
      
      , so the difference settles now as <code>
        when
      </code>
      
       says, whatever the organization's default; a gifted plan's holder's checkout of the plan, which ends the gift, with the address's campaign (its code and attribution, a refused code dropped) and in the currency its price shows where the catalog prices more than one, as <code>
        <PricingTable>
      </code>
      
       checks it out (<code>
        options
      </code>
      
       go with it, over those, <code>
        { redirect: true }
      </code>
      
       by default). Rejects with what the call threw, <code>
        error
      </code>
      
       holds it too, and the confirmation stays open.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="switchto">
        
      </a>
      
       <code>
        switchTo
      </code>
    </td>
    
    <td>
      (<code>
        productId
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Switch to <code>
        productId
      </code>
      
       at once, past any confirmation, settling the period's difference now (<code>
        proration: 'invoice'
      </code>
      
      ): the switch <code>
        changeOf
      </code>
      
       describes.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="isloading">
        
      </a>
      
       <code>
        isLoading
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      <code>
        true
      </code>
      
       until the switch's prices are known (<code>
        false
      </code>
      
       without a plan to switch from, and once the read failed).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="ispending">
        
      </a>
      
       <code>
        isPending
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      <code>
        true
      </code>
      
       while a switch or a gifted plan's checkout is on its way.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="error">
        
      </a>
      
       <code>
        error
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      < | <a href="https://nuxt-backend.dev/docs/reference/api/functions#backenderror">
        <code>
          BackendError
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      Why the last switch failed, else why the prices could not be read, else <code>
        null
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts" rel="nofollow">
        src/runtime/vue/composables/use-plan-change.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

## Type Aliases

### PlanChangeApplies

```ts
type PlanChangeApplies = 
  | PlanChangePreview["applies"]
  | "checkout";
```

Defined in: [src/runtime/vue/composables/use-plan-change.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts)

How a switch goes: `'now'` at once, `'period_end'` when the paid year
runs out (`useBilling().changeOf` says which), `'checkout'` for a gifted
plan's holder, whose switch is a checkout of the plan that ends the gift.

## Functions

### usePlanChange()

```ts
function usePlanChange(options?): UsePlanChangeReturn;
```

Defined in: [src/runtime/vue/composables/use-plan-change.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-plan-change.ts)

A subscriber's switch to another plan or billing period, without its
markup: the prices it can move to, in the subscription's own currency,
and one confirmation that says what the switch does before it does it —
the price, when it happens (a yearly price left for a monthly one waits
for the paid year's end) and how the period's difference is settled, or,
in a trial, what becomes of it — then the switch itself, settling that
difference at once (`proration: 'invoice'`), so the words stay true
whatever the organization's default. A gifted plan's holder is asked
too: their switch is a checkout of the new plan, which ends the gift.
What `<PricingTable>` and the billing section of `/settings` confirm.

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="#useplanchangeoptions">
        <code>
          UsePlanChangeOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

#### Returns

[`UsePlanChangeReturn`](#useplanchangereturn)

#### Example

```vue
<script setup lang="ts">
const change = usePlanChange()
</script>
<template>
  <button v-for="target in change.targets.value" :key="target.productId" @click="change.open(target)">
    {{ target.plan }} · {{ target.price }}
  </button>
  <div v-if="change.target.value" role="group" :aria-label="change.title.value">
    <p>{{ change.title.value }} {{ change.when.value }}</p>
    <button :aria-disabled="change.isPending.value || undefined" @click="change.confirm()">Confirm switch</button>
    <button @click="change.close()">Not now</button>
  </div>
</template>
```


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
