Lists public pricing plans.
The listPublicPlans()
function returns a Promise that resolves to a list of up to 100 public pricing plans.
Public plans are visible plans that site visitors can see on the site and purchase.
You do not need "Manage Pricing Plans" permissions to list public plans.
function listPublicPlans(
planIds: Array<string>,
options: ListPublicPlanOptions,
): Promise<Array<PublicPlans>>;
IDs of public plans to list. You can pass a maximum of 50 IDs. If not specified, all public plans 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 public plans.
import { Permissions, webMethod } from "wix-web-module";
import wixPricingPlansBackend from "wix-pricing-plans-backend";
export const myListPublicPlansFunction = webMethod(Permissions.Anyone, () => {
const planIds = [
"001c0674-d7c9-4c77-acb5-b492b427b201",
"003d0674-d7c9-4d88-acb5-b492b427b302",
"011d0123-d7c9-5e44-acb5-d300a123b321",
];
const options = {
limit: 10,
skip: 1,
};
return wixPricingPlansBackend
.listPublicPlans(planIds, options)
.then((publicPlans) => {
// Array of the specified public pricing plan objects
console.log(publicPlans);
})
.catch((error) => {
console.error(error);
});
});
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.