> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: listPublicPlans(options: ListPublicPlansOptions) # Method package: wixPricingPlansV2 # Method menu location: wixPricingPlansV2 --> plans --> listPublicPlans # Method Link: https://dev.wix.com/docs/velo/apis/wix-pricing-plans-v2/plans/list-public-plans.md # Method Description: Retrieves a list of up to 100 public pricing plans. Public plans are visible plans that are available to site visitors and can be purchased. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## List public plans ```javascript import { plans } from 'wix-pricing-plans.v2'; import { elevate } from 'wix-auth'; export async function myListPublicPlansFunction() { try { const elevatedListPublicPlans = elevate(plans.listPublicPlans); const plansList = await elevatedListPublicPlans(); return plansList; } catch(error) { console.error(error); // Handle the error } } /* Promise resolves to: * { * "pagingMetadata": { * "count": 5, * "hasNext": false, * "offset": 0, * "total": 5 * }, * "plans": [ * { * "_createdDate": "2024-01-08T14:33:12.209Z", * "_id": "d2fa5805-0d1a-4cfb-9b43-e683cf5fa990", * "_updatedDate": "2024-01-08T14:33:12.209Z", * "allowFutureStartDate": false, * "archived": false, * "buyerCanCancel": true, * "description": "The value plan", * "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb", * "hasOrders": false, * "maxPurchasesPerBuyer": 1, * "name": "Silver Membership - Monthly", * "perks": { * "values": [ * "Full site access", * "Full video access", * "Consultation booking" * ] * }, * "primary": false, * "pricing": { * "freeTrialDays": 14, * "price": { * "currency": "EUR", * "value": "100" * }, * "slug": "silver-membership-monthly", * "subscription": { * "cycleCount": 0, * "cycleDuration": { * "count": 1, * "unit": "MONTH" * } * } * }, * "termsAndConditions": "" * }, * { * "_createdDate": "2024-01-07T07:33:59.973Z", * "_id": "b20feb39-a452-453e-96ee-01036adcd04e", * "_updatedDate": "2024-01-09T09:08:05.665Z", * "allowFutureStartDate": false, * "archived": false, * "buyerCanCancel": true, * "description": "Full feature enablement - lifetime plan", * "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb", * "hasOrders": false, * "maxPurchasesPerBuyer": 0, * "name": "Premium Plan - Lifetime Membership", * "perks": { * "values": [ * "Cloud drive and file upload services", * "Unlimited video content access" * ] * }, * "primary": false, * "pricing": { * "price": { * "currency": "EUR", * "value": "1000" * }, * "singlePaymentUnlimited": true * }, * "slug": "premium-plan-lifetime-membership", * "termsAndConditions": "This plan allows unlimited app and site features usage for all time, subject to our fair usage agreement and basic human decency agreement.", * }, * { * "_createdDate": "2024-01-07T07:28:42.863Z", * "_id": "838f2c9d-c8d0-4799-a10a-e2f23849db10", * "_updatedDate": "2024-01-07T08:36:07.520Z", * "allowFutureStartDate": false, * "archived": false, * "buyerCanCancel": true, * "description": "Complete with all features. One month free trial.", * "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb", * "hasOrders": false, * "maxPurchasesPerBuyer": 0, * "name": "Premium Plan - annual - 30 day trial", * "perks": { * "values": [ * "Unlimited video library streaming access", * "File sharing enabled for all channels" * ] * }, * "primary": false, * "pricing": { * "cycleCount": 2, * "cycleDuration": { * "count": 1, * "unit": "YEAR" * }, * "freeTrialDays": 30, * "price": { * "currency": "EUR", * "value": "500" * }, * "subscription": { * "cycleCount": 2, * "cycleDuration": { * "count": 1, * "unit": "YEAR" * } * } * }, * "slug": "premium-plan-annual-30-day-trial-1", * "termsAndConditions": "Unlimited usage of services, subject to Fair Usage and Code of Conduct policies.", * }, * { * "_createdDate": "2024-01-07T07:10:30.074Z", * "_id": "cb4a8c57-273a-4567-94e3-cc43d5d339f2", * "_updatedDate": "2024-01-07T07:10:30.074Z", * "allowFutureStartDate": false, * "archived": false, * "buyerCanCancel": true, * "description": "3 mo free trial with discount for 1 year", * "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb", * "hasOrders": false, * "maxPurchasesPerBuyer": 0, * "name": "Beginner's Plan", * "perks": { * "values": [] * }, * "primary": false, * "pricing": { * "cycleCount": 2, * "cycleDuration": { * "count": 1, * "unit": "YEAR" * }, * "freeTrialDays": 90, * "price": { * "currency": "EUR", * "value": "50" * } * }, * "slug": "beginners-plan", * "termsAndConditions": "" * }, * { * "_createdDate": "2024-01-07T08:18:16.411Z", * "_id": "7a3375ce-18a9-42cb-8e39-47918ade45ec", * "_updatedDate": "2024-01-07T08:18:16.411Z", * "allowFutureStartDate": false, * "archived": false, * "buyerCanCancel": true, * "description": "Affordable with great functionality. Expires after 1 year", * "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb", * "hasOrders": false, * "maxPurchasesPerBuyer": 0, * "name": "Basic Plan - monthly subscription", * "perks": { * "values": [ * "Access to select video channels", * "Access to rich site content", * "Access to designated file store" * ] * }, * "primary": false, * "pricing": { * "cycleCount": 12, * "cycleDuration": { * "count": 1, * "unit": "MONTH" * }, * "price": { * "currency": "EUR", * "value": "5" * }, * "slug": "basic-plan-monthly-subscription" * }, * "termsAndConditions": "" * } * ], * } */ ``` ## List public plans (export from backend code) ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { plans } from 'wix-pricing-plans.v2'; import { elevate } from 'wix-auth'; export const myListPublicPlansFunction = webMethod(Permissions.Anyone, async () => { try { const elevatedListPublicPlans = elevate(plans.listPublicPlans); const plansList = await elevatedListPublicPlans(); return plansList; } catch(error) { console.error(error); // Handle the error } }); /* Promise resolves to: * { * "pagingMetadata": { * "count": 5, * "hasNext": false, * "offset": 0, * "total": 5 * }, * "plans": [ * { * "_createdDate": "2024-01-08T14:33:12.209Z", * "_id": "d2fa5805-0d1a-4cfb-9b43-e683cf5fa990", * "_updatedDate": "2024-01-08T14:33:12.209Z", * "allowFutureStartDate": false, * "archived": false, * "buyerCanCancel": true, * "description": "The value plan", * "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb", * "hasOrders": false, * "maxPurchasesPerBuyer": 1, * "name": "Silver Membership - Monthly", * "perks": { * "values": [ * "Full site access", * "Full video access", * "Consultation booking" * ] * }, * "primary": false, * "pricing": { * "freeTrialDays": 14, * "price": { * "currency": "EUR", * "value": "100" * }, * "slug": "silver-membership-monthly", * "subscription": { * "cycleCount": 0, * "cycleDuration": { * "count": 1, * "unit": "MONTH" * } * } * }, * "termsAndConditions": "" * }, * { * "_createdDate": "2024-01-07T07:33:59.973Z", * "_id": "b20feb39-a452-453e-96ee-01036adcd04e", * "_updatedDate": "2024-01-09T09:08:05.665Z", * "allowFutureStartDate": false, * "archived": false, * "buyerCanCancel": true, * "description": "Full feature enablement - lifetime plan", * "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb", * "hasOrders": false, * "maxPurchasesPerBuyer": 0, * "name": "Premium Plan - Lifetime Membership", * "perks": { * "values": [ * "Cloud drive and file upload services", * "Unlimited video content access" * ] * }, * "primary": false, * "pricing": { * "price": { * "currency": "EUR", * "value": "1000" * }, * "singlePaymentUnlimited": true * }, * "slug": "premium-plan-lifetime-membership", * "termsAndConditions": "This plan allows unlimited app and site features usage for all time, subject to our fair usage agreement and basic human decency agreement.", * }, * { * "_createdDate": "2024-01-07T07:28:42.863Z", * "_id": "838f2c9d-c8d0-4799-a10a-e2f23849db10", * "_updatedDate": "2024-01-07T08:36:07.520Z", * "allowFutureStartDate": false, * "archived": false, * "buyerCanCancel": true, * "description": "Complete with all features. One month free trial.", * "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb", * "hasOrders": false, * "maxPurchasesPerBuyer": 0, * "name": "Premium Plan - annual - 30 day trial", * "perks": { * "values": [ * "Unlimited video library streaming access", * "File sharing enabled for all channels" * ] * }, * "primary": false, * "pricing": { * "cycleCount": 2, * "cycleDuration": { * "count": 1, * "unit": "YEAR" * }, * "freeTrialDays": 30, * "price": { * "currency": "EUR", * "value": "500" * }, * "subscription": { * "cycleCount": 2, * "cycleDuration": { * "count": 1, * "unit": "YEAR" * } * } * }, * "slug": "premium-plan-annual-30-day-trial-1", * "termsAndConditions": "Unlimited usage of services, subject to Fair Usage and Code of Conduct policies.", * }, * { * "_createdDate": "2024-01-07T07:10:30.074Z", * "_id": "cb4a8c57-273a-4567-94e3-cc43d5d339f2", * "_updatedDate": "2024-01-07T07:10:30.074Z", * "allowFutureStartDate": false, * "archived": false, * "buyerCanCancel": true, * "description": "3 mo free trial with discount for 1 year", * "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb", * "hasOrders": false, * "maxPurchasesPerBuyer": 0, * "name": "Beginner's Plan", * "perks": { * "values": [] * }, * "primary": false, * "pricing": { * "cycleCount": 2, * "cycleDuration": { * "count": 1, * "unit": "YEAR" * }, * "freeTrialDays": 90, * "price": { * "currency": "EUR", * "value": "50" * } * }, * "slug": "beginners-plan", * "termsAndConditions": "" * }, * { * "_createdDate": "2024-01-07T08:18:16.411Z", * "_id": "7a3375ce-18a9-42cb-8e39-47918ade45ec", * "_updatedDate": "2024-01-07T08:18:16.411Z", * "allowFutureStartDate": false, * "archived": false, * "buyerCanCancel": true, * "description": "Affordable with great functionality. Expires after 1 year", * "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb", * "hasOrders": false, * "maxPurchasesPerBuyer": 0, * "name": "Basic Plan - monthly subscription", * "perks": { * "values": [ * "Access to select video channels", * "Access to rich site content", * "Access to designated file store" * ] * }, * "primary": false, * "pricing": { * "cycleCount": 12, * "cycleDuration": { * "count": 1, * "unit": "MONTH" * }, * "price": { * "currency": "EUR", * "value": "5" * }, * "slug": "basic-plan-monthly-subscription" * }, * "termsAndConditions": "" * } * ], * } */ ``` ## List public plans with options ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { plans } from 'wix-pricing-plans.v2'; import { elevate } from 'wix-auth'; /* Sample options value: * { * limit: 3, * offset: 1, * planIds: [ * "d2fa5805-0d1a-4cfb-9b43-e683cf5fa990", * "b20feb39-a452-453e-96ee-01036adcd04e", * "025a0d1f-7076-4e27-9696-4a67075dc2aa", * "838f2c9d-c8d0-4799-a10a-e2f23849db10", * "cb4a8c57-273a-4567-94e3-cc43d5d339f2", * "7a3375ce-18a9-42cb-8e39-47918ade45ec" * ] * } */ export const myListPublicPlansFunction = webMethod(Permissions.Anyone, async (options) => { try { const elevatedListPublicPlans = elevate(plans.listPublicPlans); const plansList = await elevatedListPublicPlans(options); return plansList; } catch(error) { console.error(error); // Handle the error } }); /* Promise resolves to: * { * "pagingMetadata": { * "count": 3, * "hasNext": true, * "offset": 1, * "total": 5 * }, * "plans": [ * { * "_createdDate": "2024-01-07T07:33:59.973Z", * "_id": "b20feb39-a452-453e-96ee-01036adcd04e", * "_updatedDate": "2024-01-09T09:08:05.665Z", * "allowFutureStartDate": false, * "archived": false, * "buyerCanCancel": true, * "description": "Full feature enablement - lifetime plan", * "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb", * "hasOrders": false, * "maxPurchasesPerBuyer": 0, * "name": "Premium Plan - Lifetime Membership", * "perks": { * "values": [ * "Cloud drive and file upload services", * "Unlimited video content access" * ] * }, * "primary": false, * "pricing": { * "price": { * "currency": "EUR", * "value": "1000" * }, * "singlePaymentUnlimited": true * }, * "slug": "premium-plan-lifetime-membership", * "termsAndConditions": "This plan allows unlimited app and site features usage for all time, subject to our fair usage agreement and basic human decency agreement.", * }, * { * "_createdDate": "2024-01-07T07:28:42.863Z", * "_id": "838f2c9d-c8d0-4799-a10a-e2f23849db10", * "_updatedDate": "2024-01-07T08:36:07.520Z", * "allowFutureStartDate": false, * "archived": false, * "buyerCanCancel": true, * "description": "Complete with all features. One month free trial.", * "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb", * "hasOrders": false, * "maxPurchasesPerBuyer": 0, * "name": "Premium Plan - annual - 30 day trial", * "perks": { * "values": [ * "Unlimited video library streaming access", * "File sharing enabled for all channels" * ] * }, * "primary": false, * "pricing": { * "cycleCount": 2, * "cycleDuration": { * "count": 1, * "unit": "YEAR" * }, * "freeTrialDays": 30, * "price": { * "currency": "EUR", * "value": "500" * }, * "subscription": { * "cycleCount": 2, * "cycleDuration": { * "count": 1, * "unit": "YEAR" * } * } * }, * "slug": "premium-plan-annual-30-day-trial-1", * "termsAndConditions": "Unlimited usage of services, subject to Fair Usage and Code of Conduct policies.", * }, * { * "_createdDate": "2024-01-07T07:10:30.074Z", * "_id": "cb4a8c57-273a-4567-94e3-cc43d5d339f2", * "_updatedDate": "2024-01-07T07:10:30.074Z", * "allowFutureStartDate": false, * "archived": false, * "buyerCanCancel": true, * "description": "3 mo free trial with discount for 1 year", * "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb", * "hasOrders": false, * "maxPurchasesPerBuyer": 0, * "name": "Beginner's Plan", * "perks": { * "values": [] * }, * "primary": false, * "pricing": { * "cycleCount": 2, * "cycleDuration": { * "count": 1, * "unit": "YEAR" * }, * "freeTrialDays": 90, * "price": { * "currency": "EUR", * "value": "50" * }, * }, * "slug": "beginners-plan", * "termsAndConditions": "", * } * ] * } */ ``` ## Make a plan primary ```javascript /************************************* * Backend code - plan-functions.web.js * *************************************/ import { Permissions, webMethod } from 'wix-web-module'; import { plans } from 'wix-pricing-plans.v2'; import { elevate } from 'wix-auth'; const elevatedListPublicPlans = elevate(plans.listPublicPlans); const elevatedMakePlanPrimary = elevate(plans.makePlanPrimary); export const listPublicPlans = webMethod(Permissions.Anyone, async () => { try { const response = await elevatedListPublicPlans(); const plansList = response.plans; return plansList; } catch (error) { console.error(error); // Handle the error } }); export const makePlanPrimaryFunction = webMethod(Permissions.Anyone, async (_id) => { try { const primaryPlan = await elevatedMakePlanPrimary(_id); return primaryPlan; } catch (error) { console.error(error); // Handle the error } }); /************* * Page code * *************/ import { listPublicPlans, makePlanPrimaryFunction } from 'backend/plan-functions.web'; $w.onReady(function () { populateDropdown(); $w('#plansList').onChange(async () => { await makePlanPrimaryFunction( $w('#plansList').value ) }); }); async function populateDropdown() { const plans = await listPublicPlans(); $w('#plansList').options = plans.map(item => ({ label: item.name, value: item._id }) ) } ``` ---