Skip to main content
const { result, error } = await unprice.plans.getPlanVersion({
  planVersionId: "pv_1234567890"
});

if (error) {
  // handle potential network or bad request error
  // a link to our docs will be in the `error.docs` field
  console.error(error.message);
  return;
}

console.log(result);
{
  "planVersion": {
    "id": "pv_1234567890",
    "projectId": "project_1234567890",
    "createdAtM": 1678900000,
    "updatedAtM": 1678900000,
    "planId": "plan_1234567890",
    "description": "Description of the plan version",
    "latest": true,
    "title": "Plan Version Title",
    "tags": ["tag1", "tag2"],
    "active": true,
    "status": "published",
    "publishedAt": 1678900000,
    "publishedBy": "user_1234567890",
    "archived": false,
    "archivedAt": null,
    "archivedBy": null,
    "paymentProvider": "stripe",
    "dueBehaviour": "immediate",
    "currency": "USD",
    "billingConfig": {
      "name": "Monthly",
      "billingInterval": "month",
      "billingIntervalCount": 1,
      "billingAnchor": "dayOfCreation",
      "planType": "recurring"
    },
    "whenToBill": "start",
    "gracePeriod": 0,
    "collectionMethod": "charge_automatically",
    "trialDays": 0,
    "autoRenew": true,
    "metadata": {},
    "paymentMethodRequired": true,
    "version": 1,
    "plan": {
      "id": "plan_1234567890",
      "projectId": "project_1234567890",
      "createdAtM": 1678900000,
      "updatedAtM": 1678900000,
      "slug": "plan-slug",
      "active": true,
      "description": "Description of the plan",
      "metadata": {
        "externalId": "ext_123"
      },
      "defaultPlan": false,
      "enterprisePlan": false
    },
    "planFeatures": [
      {
        "id": "pf_1234567890",
        "projectId": "project_1234567890",
        "createdAtM": 1678900000,
        "updatedAtM": 1678900000,
        "planVersionId": "pv_1234567890",
        "featureId": "feat_1234567890",
        "featureType": "usage",
        "config": {},
        "metadata": {},
        "aggregationMethod": "sum",
        "order": 1,
        "hidden": false,
        "displayFeatureText": "Feature description text",
        "feature": {
          "id": "feat_1234567890",
          "projectId": "project_1234567890",
          "createdAtM": 1678900000,
          "updatedAtM": 1678900000,
          "slug": "feature-slug",
          "code": "FEATURE_CODE",
          "title": "Feature Title",
          "description": "Feature Description"
        }
      }
    ],
    "flatPrice": "10.00"
  }
}

Request

planVersionId
string
required
The ID of the plan version to retrieve

Response

planVersion
object
required
The plan version information
planVersion.id
string
required
The ID of the plan version
planVersion.projectId
string
required
The ID of the project
planVersion.createdAtM
number
required
The creation timestamp
planVersion.updatedAtM
number
required
The last update timestamp
planVersion.planId
string
required
The ID of the plan
planVersion.description
string
required
The description of the plan version
planVersion.latest
boolean
Whether this is the latest version
planVersion.title
string
required
The title of the plan version
planVersion.tags
array
Array of tags for the plan version
planVersion.active
boolean
Whether the plan version is active
planVersion.status
string
The status of the plan version
planVersion.publishedAt
number
The publication timestamp
planVersion.publishedBy
string
The ID of the user who published the plan version
planVersion.archived
boolean
required
Whether the plan version is archived
planVersion.archivedAt
number
The archive timestamp
planVersion.archivedBy
string
The ID of the user who archived the plan version
planVersion.paymentProvider
string
required
The payment provider for the plan version
planVersion.dueBehaviour
string
required
The due behavior for the plan version
planVersion.currency
string
required
The currency for the plan version
planVersion.billingConfig
object
required
The billing configuration for the plan version
planVersion.billingConfig.name
string
required
The name of the billing configuration
planVersion.billingConfig.billingInterval
string
required
The billing interval
planVersion.billingConfig.billingIntervalCount
number
required
The number of intervals
planVersion.billingConfig.billingAnchor
number|string
required
The billing anchor (number or “dayOfCreation”)
planVersion.billingConfig.planType
string
required
The type of plan
planVersion.whenToBill
string
required
When to bill the customer
planVersion.gracePeriod
number
required
The grace period in days
planVersion.collectionMethod
string
required
The collection method
planVersion.trialDays
number
required
The number of trial days
planVersion.autoRenew
boolean
required
Whether the plan auto-renews
planVersion.metadata
object
required
Additional metadata for the plan version
planVersion.paymentMethodRequired
boolean
required
Whether a payment method is required
planVersion.version
number
required
The version number
planVersion.plan
object
required
The plan information
planVersion.plan.id
string
required
The ID of the plan
planVersion.plan.projectId
string
required
The ID of the project
planVersion.plan.createdAtM
number
required
The creation timestamp
planVersion.plan.updatedAtM
number
required
The last update timestamp
planVersion.plan.slug
string
required
The slug of the plan
planVersion.plan.active
boolean
Whether the plan is active
planVersion.plan.description
string
required
The description of the plan
planVersion.plan.metadata
object
Additional metadata for the plan
planVersion.plan.metadata.externalId
string
The external ID of the plan
planVersion.plan.defaultPlan
boolean
Whether this is the default plan
planVersion.plan.enterprisePlan
boolean
Whether this is an enterprise plan
planVersion.planFeatures
array
required
Array of plan features
planVersion.planFeatures[].id
string
required
The ID of the plan feature
planVersion.planFeatures[].projectId
string
required
The ID of the project
planVersion.planFeatures[].createdAtM
number
required
The creation timestamp
planVersion.planFeatures[].updatedAtM
number
required
The last update timestamp
planVersion.planFeatures[].planVersionId
string
required
The ID of the plan version
planVersion.planFeatures[].featureId
string
required
The ID of the feature
planVersion.planFeatures[].featureType
string
required
The type of feature
planVersion.planFeatures[].config
object
required
The configuration for the feature
planVersion.planFeatures[].metadata
object
required
Additional metadata for the feature
planVersion.planFeatures[].aggregationMethod
string
required
The aggregation method for the feature
planVersion.planFeatures[].order
number
required
The order of the feature
planVersion.planFeatures[].hidden
boolean
required
Whether the feature is hidden
planVersion.planFeatures[].displayFeatureText
string
required
The text you can use to show the clients
planVersion.planFeatures[].feature
object
required
The feature information
planVersion.planFeatures[].feature.id
string
required
The ID of the feature
planVersion.planFeatures[].feature.projectId
string
required
The ID of the project
planVersion.planFeatures[].feature.createdAtM
number
required
The creation timestamp
planVersion.planFeatures[].feature.updatedAtM
number
required
The last update timestamp
planVersion.planFeatures[].feature.slug
string
required
The slug of the feature
planVersion.planFeatures[].feature.code
string
required
The code of the feature
planVersion.planFeatures[].feature.title
string
required
The title of the feature
planVersion.planFeatures[].feature.description
string
required
The description of the feature
planVersion.flatPrice
string
required
The flat price of the plan version