> 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
# QueryPlans
# Package: pricingPlans
# Namespace: PlanService
# Method link: https://dev.wix.com/docs/api-reference/business-solutions/pricing-plans/plans-v3/query-plans.md
## Permission Scopes:
Read Orders: SCOPE.DC-PAIDPLANS.READ-ORDERS
Read Pricing Plans: SCOPE.DC-PAIDPLANS.READ-PLANS
## Introduction
Retrieves a list of plans, given the provided paging, filtering, and sorting.
Query plans runs with these defaults, which you can override:
- `createdDate` is sorted in `ASC` order
- `cursorPaging.limit` is `100`
To learn about working with queries, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language).
---
## REST API
### Schema
```
Method: queryPlans
Description: Retrieves a list of plans, given the provided paging, filtering, and sorting. Query plans runs with these defaults, which you can override: - `createdDate` is sorted in `ASC` order - `cursorPaging.limit` is `100`
To learn about working with queries, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language).
URL: https://www.wixapis.com/pricing-plans/v3/plans/query
Method: POST
Method parameters:
param name: query | type: QueryV2
- name: cursorPaging | type: CursorPaging | description: Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`.
- name: limit | type: integer | description: Maximum number of items to return in the results.
- name: cursor | type: string | description: Pointer to the next or previous page in the list of results. Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request.
- name: filter | type: object | description: Filter object. Learn more about [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#filters).
- name: sort | type: array | description: Sort object. Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#sorting).
- name: fieldName | type: string | description: Name of the field to sort by.
- name: order | type: SortOrder | description: Sort order.
- enum: ASC, DESC
Return type: QueryPlansResponse
- name: plans | type: array | description: List of plans.
- name: id | type: string | description: Plan GUID.
- name: revision | type: string | description: Revision number, which increments by 1 each time the plan is updated.
- name: createdDate | type: string | description: Date and time the plan was created.
- name: updatedDate | type: string | description: Date and time the plan was last updated.
- name: name | type: string | description: Plan name displayed to customers.
- name: description | type: string | description: Plan description that explains what customers get with this plan.
- name: image | type: Image | description: Plan image displayed during checkout and on the site's **Plans & Pricing** page.
- name: id | type: string | description: WixMedia image GUID.
- name: height | type: integer | description: Original image height.
- name: width | type: integer | description: Original image width.
- name: altText | type: string | description: Image alt text.
- name: slug | type: string | description: Unique identifier for this plan within the Wix site. If not provided, generated automatically from the plan name.
- name: termsAndConditions | type: string | description: Terms and conditions text that customers must agree to when purchasing this plan.
- name: perks | type: array | description: List of text snippets describing what the plan offers. For display purposes only.
- name: id | type: string | description: Perk GUID.
- name: description | type: string | description: Perk description.
- name: visibility | type: Visibility | description: Plan visibility.
- enum:
- PUBLIC: Plan is visible and available for purchase by all customers.
- PRIVATE: Plan isn't visible to new customers unless they get a specific link to the plan. Existing buyers can continue using it.
- name: buyable | type: boolean | description: Whether customers can currently purchase this plan. If set to `false`, customer won't be able to buy a plan themselves. In this case a Wix user has to assign the plan through the [dashboard](https://support.wix.com/en/article/pricing-plans-selling-plans-offline).
- name: formId | type: string | description: GUID of the form associated with the plan at checkout.
- name: buyerCanCancel | type: boolean | description: Whether buyers can cancel their subscription to this plan.
- name: currency | type: string | description: Three-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
- name: purchaseLimits | type: array | description: Caps how many subscriptions buyers can have or the site can sell for this plan. When multiple types are present, all must pass (AND logic). Duplicate types are rejected by the server.
- name: type | type: PurchaseLimitType | description: The type of purchase limit.
- enum:
- PER_MEMBER_LIFETIME: Limits the total number of subscriptions (any status) a single member can have over their lifetime.
- PER_MEMBER_ACTIVE: Limits the number of ongoing (ACTIVE, PENDING, PAUSED) subscriptions a single member can have at any time.
- TOTAL_ACTIVE: Limits the total number of ongoing (ACTIVE, PENDING, PAUSED) subscriptions across all members at any time.
- TOTAL_SOLD: Limits the total number of subscriptions ever created (any status) across all members.
- name: maxCount | type: integer | description: The maximum number of subscriptions allowed.
- name: extendedFields | type: ExtendedFields | description: Data extensions. Learn more about [extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md).
- name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).
- name: pagingMetadata | type: PagingMetadataV2 | description: Paging metadata.
- name: count | type: integer | description: Number of items returned in the response.
- name: offset | type: integer | description: Offset that was requested.
- name: total | type: integer | description: Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set.
- name: tooManyToCount | type: boolean | description: Flag that indicates the server failed to calculate the `total` field.
- name: cursors | type: Cursors | description: Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used.
- name: next | type: string | description: Cursor string pointing to the next page in the list of results.
- name: prev | type: string | description: Cursor pointing to the previous page in the list of results.
```
### Examples
### Query Plans
```curl
curl -X POST \
'https://www.wixapis.com/pricing-plans/v3/bulk/plans/query' \
-H 'Authorization: ' \
-H 'Content-Type: application/json' \
-d '{
"query": {
"filter": {
"visibility": "PUBLIC",
"pricingVariants.pricingStrategies.flatRate.amount": {
"$gte": "5.00",
"$lte": "50.00"
}
},
"sort": [
{
"fieldName": "name",
"order": "ASC"
}
],
"cursorPaging": {
"limit": 10
}
}
}'
```
---
## JavaScript SDK
### Schema
```
Method: wixClientAdmin.pricingPlans.PlanService.queryPlans(query)
Description: Retrieves a list of plans, given the provided paging, filtering, and sorting. Query plans runs with these defaults, which you can override: - `createdDate` is sorted in `ASC` order - `cursorPaging.limit` is `100`
To learn about working with queries, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language).
# Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
Required parameters: query
Method parameters:
param name: query | type: PlanQuery | required: true
- name: cursorPaging | type: CursorPaging | description: Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`.
- name: limit | type: integer | description: Maximum number of items to return in the results.
- name: cursor | type: string | description: Pointer to the next or previous page in the list of results. Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request.
- name: filter | type: object | description: Filter object. Learn more about [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#filters).
- name: sort | type: array | description: Sort object. Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#sorting).
- name: fieldName | type: string | description: Name of the field to sort by.
- name: order | type: SortOrder | description: Sort order.
- enum: ASC, DESC
Return type: PROMISE
- name: plans | type: array | description: List of plans.
- name: _id | type: string | description: Plan GUID.
- name: revision | type: string | description: Revision number, which increments by 1 each time the plan is updated.
- name: _createdDate | type: Date | description: Date and time the plan was created.
- name: _updatedDate | type: Date | description: Date and time the plan was last updated.
- name: name | type: string | description: Plan name displayed to customers.
- name: description | type: string | description: Plan description that explains what customers get with this plan.
- name: image | type: string | description: Plan image displayed during checkout and on the site's **Plans & Pricing** page.
- name: slug | type: string | description: Unique identifier for this plan within the Wix site. If not provided, generated automatically from the plan name.
- name: termsAndConditions | type: string | description: Terms and conditions text that customers must agree to when purchasing this plan.
- name: perks | type: array | description: List of text snippets describing what the plan offers. For display purposes only.
- name: _id | type: string | description: Perk GUID.
- name: description | type: string | description: Perk description.
- name: visibility | type: Visibility | description: Plan visibility.
- enum:
- PUBLIC: Plan is visible and available for purchase by all customers.
- PRIVATE: Plan isn't visible to new customers unless they get a specific link to the plan. Existing buyers can continue using it.
- name: buyable | type: boolean | description: Whether customers can currently purchase this plan. If set to `false`, customer won't be able to buy a plan themselves. In this case a Wix user has to assign the plan through the [dashboard](https://support.wix.com/en/article/pricing-plans-selling-plans-offline).
- name: formId | type: string | description: GUID of the form associated with the plan at checkout.
- name: buyerCanCancel | type: boolean | description: Whether buyers can cancel their subscription to this plan.
- name: currency | type: string | description: Three-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
- name: purchaseLimits | type: array | description: Caps how many subscriptions buyers can have or the site can sell for this plan. When multiple types are present, all must pass (AND logic). Duplicate types are rejected by the server.
- name: type | type: PurchaseLimitType | description: The type of purchase limit.
- enum:
- PER_MEMBER_LIFETIME: Limits the total number of subscriptions (any status) a single member can have over their lifetime.
- PER_MEMBER_ACTIVE: Limits the number of ongoing (ACTIVE, PENDING, PAUSED) subscriptions a single member can have at any time.
- TOTAL_ACTIVE: Limits the total number of ongoing (ACTIVE, PENDING, PAUSED) subscriptions across all members at any time.
- TOTAL_SOLD: Limits the total number of subscriptions ever created (any status) across all members.
- name: maxCount | type: integer | description: The maximum number of subscriptions allowed.
- name: extendedFields | type: ExtendedFields | description: Data extensions. Learn more about [extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md).
- name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).
- name: pagingMetadata | type: PagingMetadataV2 | description: Paging metadata.
- name: count | type: integer | description: Number of items returned in the response.
- name: offset | type: integer | description: Offset that was requested.
- name: total | type: integer | description: Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set.
- name: tooManyToCount | type: boolean | description: Flag that indicates the server failed to calculate the `total` field.
- name: cursors | type: Cursors | description: Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used.
- name: next | type: string | description: Cursor string pointing to the next page in the list of results.
- name: prev | type: string | description: Cursor pointing to the previous page in the list of results.
```
### Examples
### Query plans
```javascript
import { plansV3 } from "@wix/pricing-plans";
async function queryPlans() {
const response = await plansV3
.queryPlans()
.eq("visibility", "PUBLIC")
.ge("pricingVariants.pricingStrategies.flatRate.amount", "5.00")
.le("pricingVariants.pricingStrategies.flatRate.amount", "50.00")
.ascending("name")
.limit(10)
.find();
}
/* Promise resolves to:
* {
* "_items": [
* {
* "_id": "5d1c47f5-0ec7-4c9c-9f9c-a87be388e3f9",
* "revision": "1",
* "name": "Professional Studio",
* "pricingVariants": [
* {
* "_id": "6304bd66-128e-454e-8c95-e389b78cc7e1",
* "name": "Monthly",
* "billingTerms": {
* "billingCycle": {
* "period": "MONTH",
* "count": "1"
* },
* "startType": "ON_PURCHASE",
* "endType": "UNTIL_CANCELLED"
* },
* "pricingStrategies": [
* {
* "flatRate": {
* "amount": "5.99"
* }
* }
* ]
* }
* ],
* "visibility": "PUBLIC",
* "buyable": true,
* "status": "ACTIVE",
* "buyerCanCancel": true,
* "currency": "EUR"
* }
* ],
* "cursors": {}
* }
*/
```
### queryPlans (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).
```javascript
import { createClient } from '@wix/sdk';
import { plansV3 } from '@wix/pricing-plans';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed
const myWixClient = createClient ({
modules: { plansV3 },
// Include the auth strategy and host as relevant
});
async function queryPlans(query) {
const response = await myWixClient.plansV3.queryPlans(query);
};
```
---