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
The ID of the plan version to retrieve
Response
The plan version information
The ID of the plan version
The last update timestamp
The description of the plan version
Whether this is the latest version
The title of the plan version
Array of tags for the plan version
Whether the plan version is active
The status of the plan version
The publication timestamp
The ID of the user who published the plan version
Whether the plan version is archived
The ID of the user who archived the plan version
planVersion.paymentProvider
The payment provider for the plan version
The due behavior for the plan version
The currency for the plan version
planVersion.billingConfig
The billing configuration for the plan version
planVersion.billingConfig.name
The name of the billing configuration
planVersion.billingConfig.billingInterval
The billing interval
planVersion.billingConfig.billingIntervalCount
The number of intervals
planVersion.billingConfig.billingAnchor
The billing anchor (number or “dayOfCreation”)
planVersion.billingConfig.planType
The type of plan
When to bill the customer
planVersion.collectionMethod
The collection method
Whether the plan auto-renews
Additional metadata for the plan version
planVersion.paymentMethodRequired
Whether a payment method is required
planVersion.plan.projectId
The ID of the project
planVersion.plan.createdAtM
The creation timestamp
planVersion.plan.updatedAtM
The last update timestamp
Whether the plan is active
planVersion.plan.description
The description of the plan
planVersion.plan.metadata
Additional metadata for the plan
planVersion.plan.metadata.externalId
The external ID of the plan
planVersion.plan.defaultPlan
Whether this is the default plan
planVersion.plan.enterprisePlan
Whether this is an enterprise plan
planVersion.planFeatures[].id
The ID of the plan feature
planVersion.planFeatures[].projectId
The ID of the project
planVersion.planFeatures[].createdAtM
The creation timestamp
planVersion.planFeatures[].updatedAtM
The last update timestamp
planVersion.planFeatures[].planVersionId
The ID of the plan version
planVersion.planFeatures[].featureId
The ID of the feature
planVersion.planFeatures[].featureType
The type of feature
planVersion.planFeatures[].config
The configuration for the feature
planVersion.planFeatures[].metadata
Additional metadata for the feature
planVersion.planFeatures[].aggregationMethod
The aggregation method for the feature
planVersion.planFeatures[].order
The order of the feature
planVersion.planFeatures[].hidden
Whether the feature is hidden
planVersion.planFeatures[].displayFeatureText
The text you can use to show the clients
planVersion.planFeatures[].feature
The feature information
planVersion.planFeatures[].feature.id
The ID of the feature
planVersion.planFeatures[].feature.projectId
The ID of the project
planVersion.planFeatures[].feature.createdAtM
The creation timestamp
planVersion.planFeatures[].feature.updatedAtM
The last update timestamp
planVersion.planFeatures[].feature.slug
The slug of the feature
planVersion.planFeatures[].feature.code
The code of the feature
planVersion.planFeatures[].feature.title
The title of the feature
planVersion.planFeatures[].feature.description
The description of the feature
The flat price of the plan version