Lists pricing plans.
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.
function listPlans(
planIds: Array<string>,
options: ListPlanInfo,
): Promise<Array<Plans>>;
IDs of plans to list. You can pass a maximum of 50 IDs.
If not specified, all public and hidden plans (based on the options
) are listed (up to 50), according to the order displayed
in the Dashboard. If non-existent IDs are specified, they are ignored and do not cause errors.
Options to use when getting the list of plans.
import wixPricingPlansBackend from "wix-pricing-plans-backend";
export function listPlans() {
const planIds = [
"001c0674-d7c9-4c77-acb5-b492b427b201",
"003d0674-d7c9-4d88-acb5-b492b427b302",
"011d0123-d7c9-5e44-acb5-d300a123b321",
];
const options = {
limit: 10,
skip: 3,
archived: "ARCHIVED_AND_ACTIVE",
public: "PUBLIC_AND_HIDDEN",
};
return wixPricingPlansBackend
.listPlans(planIds, options)
.then((plans) => {
// Array of all the specified pricing plan objects that match the criteria
console.log(plans);
})
.catch((error) => {
console.error(error);
});
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.