Search.../

listPlans( )

Lists pricing plans.

Description

The listPlans() function returns a Promise that resolves to a list of up to 100 pricing plans.

Only users with "Manage Pricing Plans" permissions can use this function to list plans.

Authorization

Request

This endpoint does not take any parameters

Response Object

Fulfilled - List of plans that match the given criteria.

NAME
TYPE
DESCRIPTION
plans
Array<Plan>

List of public and hidden pricing plans.

Status/Error Codes

Was this helpful?

List plans

Copy Code
1import wixPricingPlansBackend from 'wix-pricing-plans-backend';
2
3export function listPlans() {
4 const planIds = [
5 "001c0674-d7c9-4c77-acb5-b492b427b201",
6 "003d0674-d7c9-4d88-acb5-b492b427b302",
7 "011d0123-d7c9-5e44-acb5-d300a123b321"
8 ];
9 const options = {
10 limit: 10,
11 skip: 3,
12 archived: "ARCHIVED_AND_ACTIVE",
13 public: "PUBLIC_AND_HIDDEN"
14 }
15 return wixPricingPlansBackend.listPlans(planIds, options)
16 .then((plans) => {
17 // Array of all the specified pricing plan objects that match the criteria
18 console.log(plans);
19 })
20 .catch((error) => {
21 console.error(error);
22 });
23}
List archived plans

Copy Code
1/****************************
2 * Backend code - plans.jsw *
3 ****************************/
4import wixPricingPlansBackend from 'wix-pricing-plans-backend';
5
6export function listPlans(planIds, options) {
7 return wixPricingPlansBackend.listPlans(planIds, options);
8}
9
10/*************
11 * Page code *
12 *************/
13import { listPlans } from 'backend/plans';
14
15// ..
16
17$w("#listPlansButton").onClick((event) => {
18 const planIds = [];
19 const options = {
20 limit: 10,
21 skip: 1,
22 archived: "ARCHIVED"
23 }
24 listPlans(planIds, options)
25 .then((plans) => {
26 const firstPlanName = plans[0].name;
27 console.log("First plan is: " + firstPlanName + " and the rest are: ");
28 // Array of all the specified pricing plan objects that match the criteria
29 console.log(plans);
30 })
31 .catch((error) => {
32 console.error(error);
33 });
34});