Using the Plans API, you can create and manage pricing plans.
This includes building a customized membership plan experience, including implementing a customizable pricing page where customers can view the plans, including their perks, prices, and other features including free trials, purchase limitations, and more.
With the Plans API, you can:
Create and update plans. This includes:
Setting up pricing models for plans, such as free, one-time payment, and recurring payments (subscriptions).
Determining if pricing plans should have a duration or be valid until canceled by a customer.
Limiting plans so they can be purchased only 1 time by a single customer. By default, customers can make unlimited purchases of the same plan.
Note that updating the properties of an existing pricing plan doesn't affect any current orders or purchases of the plan. Existing orders retain their existing terms and pricing.
Get, list, and query plans.
Change the visibility, availability, and accessibility of a plan.
Get statistics about plans.
Archive plans.
Set or clear the primary plan. This determines if a plan is highlighted with a custom ribbon when viewing the plans on a site.
It's important to explore the types of plans available and other specifications, such as payment options and purchasing constraints.
Pricing plans can be:
Free plans. There is no charge to the site visitor or member.
One-time payment plans. The site visitor or member is charged once. These plans can be set to expire or continue indefinitely until they cancel.
Recurring plans. The site visitor or member is charged at predefined intervals (such as weekly, monthly, yearly). These plans can be set to expire or continue indefinitely until they cancel the subscription. Recurring plans can have free trial days.
Recurring plans can be set to have free trial days using the plan's freeTrialDays
property.
During free trial days, site visitor and members can cancel the plan and they won’t be charged.
Free trial days are applied only once per site visitor or member for a plan. This means that if a plan with a free trial was purchased once, the second time they purchase it, the free trial days aren't applied. In this case, the site visitor or member is charged for the plan right away.
Some plans can be purchased only a limited number of times by a single site visitor or member based on the value of the plan's purchaseLimitations
property.
If the plan is updated, the limit is checked by the current plan details. For example, let's assume a plan's purchase limit was initially set to 1 and a site visitor or member purchased the plan. If later the limit is updated to 2, they can still purchase the same plan a second time.
A plan can be active for specified periods of time from the date of purchase. The active period is established in the same intervals as the payment periods (weeks, months, years). Plans can also be defined so they never expire (meaning, the plan continues indefinitely until the member cancels). This is true for both one-time and recurring plans.
Slugs are used to support dynamic pages.
A slug is generated on a plan's creation and is updated when a plan's name is updated. For example, if the plan's name is "Test Plan," the generated slug is "test-plan." If a plan already exists with a slug "test-plan" for the site, a number is appended to it. The slug becomes "test-plan-1".
It's important to note the following point before starting to code:
Plan: A membership plan or package, offering bundles of features or “perks.”
Primary plans: Plans that are labeled with a ribbon that is customizable on a site.
Archived plans: Plans that can no longer be purchased or edited, but existing plan holders can still enjoy purchased membership and continue to be charged until canceled or expired.
Hidden plans: Plans that are not currently visible to customers. Hidden plans may still be sold manually to customers.
Free trial: A feature allowing for the trying out of the perks of the plan for a selected amount of days before the first charge. Relevant for recurring plans.
Plan Policy: The definition of terms and conditions for the customer. A plan's policy can be displayed on a site's checkout page.
To use the Plans API, install the @wix/pricing-plans
package using npm or Yarn:
or
Then import { plans }
from @wix/pricing-plans
:
Archives a single plan.
When a plan is archived, it's no longer visible as a public plan that can be chosen by site members or visitors.
This is because the plan's public
property is automatically set to false
.
Archived plans can't be purchased or reactivated.
Plan archiving doesn't impact existing orders made for the plan. All orders for the plan are still active and keep their perks, payment options, and terms.
Wix users can see archived plans in a site's dashboard under Pricing Plans -> Archived Plans.
Note: An attempt to archive an already-archived plan throws an error.
ID of the active plan to archive.
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
Sets all pricing plans as not primary. When viewing pricing plans on a site, no plan is highlighted with a customizable ribbon.
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
Creates a pricing plan. The specified plan
object must contain a pricing model. A pricing model can be 1 of the following:
Information for the plan being created.
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
Retrieves a pricing plan by ID.
Plan ID.
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
Gets statistics about the pricing plans. Currently provides only the total number of pricing plans, including archived plans.
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Retrieves a list of up to 100 pricing plans (including public, hidden, and archived plans).
Options for filtering and paging the list of plans.
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
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.
Options for filtering and paging the list of public plans.
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.