Introduction

 

Developer Preview
APIs in Developer Preview are subject to change and are not intended for use in production.
Send us your suggestions for improving this API. Your feedback is valuable to us.

 

The Pricing Plans Plans API allows you to manage your pricing plans.

With the Pricing Plans Plans API, you can:

To use the Pricing Plans Plans API, import { plans } from the wix-pricing-plans.v2 module.

Copy
Did this help?

archivePlan( )


Archives a single plan.

The archivePlan() function returns a Promise that resolves to the newly-archived plan.

When a plan is archived, the plan

  • Is no longer available for display or selection by visitors. This is because the plan's public property is automatically set to false.
  • Cannot be purchased.
  • Cannot be "un-archived", meaning the plan cannot be made active again.

Plan archiving does not impact existing purchases made for the plan. All purchases for the plan are still active and keep their payment options and terms.

Site owners can see archived plans in the Dashboard under Pricing Plans -> Archived Plans.

Note: An attempt to archive an already-archived plan throws an error.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Pricing Plans
Learn more about app permissions.
Method Declaration
Copy
Method Parameters
_idstringRequired

ID of the active plan to archive.

Returns
Return Type:Promise<ArchivePlanResponse>
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

clearPrimary( )


Sets all pricing plans to no longer be primary.

The clearPrimary() function returns a Promise that is resolved when there are no pricing plans marked as primary.

After clearing the primary plan, when viewing pricing plans on the site, no plan is highlighted with a customizable ribbon.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Pricing Plans
Learn more about app permissions.
Method Declaration
Copy
Request
This method does not take any parameters
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

createPlan( )


Creates a pricing plan.

The createPlan() function returns a Promise that resolves to a newly-created pricing plan after is has successfully been created.

The passed plan object must contain a pricing model. A pricing model can be one of the following:

  • A subscription: A subscription with recurring payment and how often the plan occurs. Subscriptions can have free trial days.
  • A plan that does not renew: A single payment for a specific duration that doesn't renew.
  • An unlimited plan: A single payment for an unlimited amount of time (until canceled).

Pricing plans created by this function are available to the site owner in the Pricing Plans section in the Dashboard.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Pricing Plans
Learn more about app permissions.
Method Declaration
Copy
Method Parameters
planPlanRequired

Information for the plan being created.

Returns
Return Type:Promise<Plan>
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

getPlan( )


Retrieves a pricing plan by the specified ID.

The getPlan() function returns a Promise that resolves to a plan whose ID matched the specified ID.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Pricing Plans
Read Pricing Plans
Learn more about app permissions.
Method Declaration
Copy
Method Parameters
_idstringRequired

Plan ID.

Returns
Return Type:Promise<Plan>
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

getPlanStats( )


Retrieves statistics about the pricing plans.

The getPlanStats() function returns a Promise that resolves to statistics about the plan on the site.

Currently this function provides only the total number of pricing plans, including archived plans.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Pricing Plans
Read Pricing Plans
Learn more about app permissions.
Method Declaration
Copy
Request
This method does not take any parameters
Returns
Return Type:Promise<GetPlanStatsResponse>
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

listPlans( )


Developer Preview

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 pricing plans.

The listPlans() function returns a Promise that resolves to a list of up to 100 pricing plans. This includes public, hidden, and archived plans.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Pricing Plans
Read Pricing Plans
Learn more about app permissions.
Method Declaration
Copy
Method Parameters
optionsListPlansOptions

Options for filtering and paging the list of plans.

Returns
Return Type:Promise<ListPlansResponse>
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

listPublicPlans( )


Retrieves a list of 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.

Permissions
Manage Bookings Services and Settings
Manage Orders
Read Orders
Read Pricing Plans
Manage Pricing Plans
Manage Portfolio
Manage Restaurants - all permissions
Learn more about app permissions.
Method Declaration
Copy
Method Parameters
optionsListPublicPlansOptions

Options for filtering and paging the list of public plans.

Returns
Return Type:Promise<ListPublicPlansResponse>
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

makePlanPrimary( )


Marks a pricing plan as the primary pricing plan.

The makePlanPrimary() function returns a Promise that resolves to the now primary pricing plan.

Only a single plan can be marked as a primary plan at any given time. If there is an existing plan marked as primary, calling makePlanPrimary() causes the existing primary plan to lose its primary status.

When viewing pricing plans on the site, the primary plan is highlighted with a customizable ribbon.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Pricing Plans
Learn more about app permissions.
Method Declaration
Copy
Method Parameters
_idstringRequired

ID of the pricing plan to set as the primary plan.

Returns
Return Type:Promise<MakePlanPrimaryResponse>
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

queryPublicPlans( )


Creates a query to retrieve a list of public pricing plans.

The queryPublicPlans() function builds a query to retrieve a list of up to 1,000 public plans and returns a PublicPlansQueryBuilder object.

The returned object contains the query definition which is typically used to run the query using the find() function.

You can refine the query by chaining PublicPlansQueryBuilder functions onto the query. PublicPlansQueryBuilder functions enable you to sort, filter, and control the results that queryPublicPlans() returns.

queryPublicPlans() runs with the following PublicPlansQueryBuilder defaults that you can override:

The functions that are chained to queryPublicPlans() are applied in the order they are called. For example, if you sort on the _createdDate property in ascending order and then on the _id property in ascending order, the results are sorted first by the created date of the items and then, if there are multiple results with the same date, the items are sorted by _id in ascending order, per created date value.

The following PublicPlansQueryBuilder functions are supported for the queryPublicPlans() function. For a full description of the Plans object, see the object returned for the items property in PublicPlansQueryResult.

PROPERTYSUPPORTED FILTERS & SORTING
_ideq(),ne(),exists(),in(),hasSome(),startsWith(),ascending(),descending()
primaryeq(),ne(),exists(),in(),hasSome(),ascending(),descending()
_createdDateeq(),ne(),exists(),in(),hasSome(),lt(),le(),gt(),ge(),ascending(),descending()
_updatedDateeq(),ne(),exists(),in(),hasSome(),lt(),le(),gt(),ge(),ascending(),descending()
slugeq(),ne(),exists(),in(),hasSome(),startsWith(),ascending(),descending()
Permissions
Manage Bookings Services and Settings
Manage Orders
Read Orders
Read Pricing Plans
Manage Pricing Plans
Manage Portfolio
Manage Restaurants - all permissions
Learn more about app permissions.
Method Declaration
Copy
Request
This method does not take any parameters
Returns
Return Type:PlansQueryBuilder
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

setPlanVisibility( )


Sets visibility for non-archived pricing plans.

The setPlanVisibility() functions returns a Promise that resolves to a pricing plan when its visibility has successfully been set.

By default, pricing plans are public, meaning they are visible. Plans can be hidden so that site members and visitors cannot see or choose them.

As opposed to archiving, setting visibility can be reversed. This means that a public plan can be hidden, and a hidden plan can be made public (visible).

Note: An archived plan always remains archived and cannot be made active again. When archiving a plan, its public property is automatically set to false so that it is hidden.

Changing a plan's visibility does not impact existing orders for the plan. All orders for hidden plans are still active and keep their terms and payment options.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Pricing Plans
Learn more about app permissions.
Method Declaration
Copy
Method Parameters
_idstringRequired

The ID of the plan to either display or hide on the site page.


visiblebooleanRequired

Whether to set the plan as visible.

Returns
Return Type:Promise<SetPlanVisibilityResponse>
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

updatePlan( )


Updates a pricing plan.

The updatePlan() function returns a Promise that resolves to an updated plan.

Updating a plan does not impact existing purchases made for the plan. All purchases keep the details of the original plan that was active at the time of the purchase.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Pricing Plans
Learn more about app permissions.
Method Declaration
Copy
Method Parameters
_idstringRequired

ID of the plan to update.


planUpdatePlanRequired

optionsUpdatePlanOptions

Options for updating the plan.

Returns
Return Type:Promise<Plan>
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?