getPlan( )
Gets an existing pricing plan by ID.
Description
The getPlan()
function returns a Promise that resolves to a plan whose ID
matches the given ID.
Only users with "Manage Pricing Plans" permissions can get plans.
Syntax
function getPlan(id: string): Promise<Plan>
getPlan Parameters
NAME
TYPE
DESCRIPTION
The ID of the plan to get.
Returns
Fulfilled - The retrieved plan's information.
Return Type:
NAME
TYPE
DESCRIPTION
Plan ID.
Plan name.
Plan description.
List of text strings that promote the pricing plan (for example, "Plenty of parking" or "Free gift on your birthday").
Plan price, payment schedule, and expiration.
Whether the plan is public (visible to site visitors).
Whether the plan is archived. Archived plans are not visible and can't be purchased anymore, but existing purchases remain in effect.
Whether the plan is marked as primary. If true
, the plan is highlighted on the site with a custom ribbon. Defaults to false
.
Whether the plan has any orders (including pending and unpaid orders).
Date plan was created.
Date plan was last updated.
URL-friendly version of the plan name. Unique across all plans in the same site.
Whether the buyer can start the plan at a later date.
Whether the buyer is allowed to cancel their plan. If false
, calling the cancelOrder()
function returns an error.
Whether the same buyer can purchase the plan multiple times. 1
means the buyer can only purchase the plan once. An empty value or 0
means no limitation.
Any terms and conditions that apply to the plan. This information is displayed during checkout.
Was this helpful?
Get a plan
1import wixPricingPlansBackend from 'wix-pricing-plans-backend';23export function myGetPlanFunction() {4 const id = '001c0674-d7c9-4c77-acb5-b492b427b201';56 return wixPricingPlansBackend.getPlan(id)7 .then((plan) => {8 console.log(plan);9 })10 .catch((error) => {11 console.error(error);12 });13}1415/* Full plan object:16 * {17 * "_id": "001c0674-d7c9-4c77-acb5-b492b427b201",18 * "name": "Gold",19 * "description": "For expert gamers",20 * "perks": [21 * "Great value for your money",22 * "Multi-user"23 * ],24 * "pricing": {25 * "subscription": {26 * "cycleDuration": {27 * "count": 1,28 * "unit": "MONTH"29 * },30 * "cycleCount": 231 * },32 * "price": {33 * "value": "100",34 * "currency": "USD"35 * },36 * "freeTrialDays": 1037 * },38 * "public": true,39 * "archived": false,40 * "primary": false,41 * "hasOrders": false,42 * "_createdDate": "2020-12-24T11:23:48.308Z",43 * "_updatedDate": "2020-12-30T11:39:45.523Z",44 * "slug": "gold",45 * "maxPurchasesPerBuyer": 1,46 * "allowFutureStartDate": false,47 * "buyerCanCancel": true,48 * "termsAndConditions": "No sharing please."49 * }50 */