> 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 # SearchPlans # Package: pricingPlans # Namespace: PlanService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/pricing-plans/plans-v3/search-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 that match the provided search query and optionally performs aggregations on the data queried. To learn about working with queries, see [Search, Query and List Methods](https://dev.wix.com/docs/rest/articles/get-started/search-query-and-list-methods.md). --- ## REST API ### Schema ``` Method: searchPlans Description: Retrieves a list of plans that match the provided search query and optionally performs aggregations on the data queried. To learn about working with queries, see [Search, Query and List Methods](https://dev.wix.com/docs/rest/articles/get-started/search-query-and-list-methods.md). URL: https://www.wixapis.com/pricing-plans/v3/plans/search Method: POST Method parameters: param name: search | type: CursorSearch - 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 - name: aggregations | type: array | description: Logical groupings of data into facets, with summaries for each facet. For example, use aggregations to allow site visitors to narrow down their search results by selecting specific categories. - ONE-OF: - name: value | type: ValueAggregation | description: Value aggregation - ONE-OF: - name: includeOptions | type: IncludeMissingValuesOptions | description: Options for including missing values - name: addToBucket | type: string | description: Can specify custom bucket name. Defaults are [string -> "N/A"], [int -> "0"], [bool -> "false"] ... - name: sortType | type: SortType | description: Should sort by number of matches or value of the field - enum: - COUNT: Should sort by number of matches - VALUE: Should sort by value of the field alphabetically - name: sortDirection | type: SortDirection | description: Should sort in ascending or descending order - enum: - DESC: Should sort in descending order - ASC: Should sort in ascending order - name: limit | type: integer | description: How many aggregations would you like to return? Can be between 1 and 250. 10 is the default. - name: missingValues | type: MissingValues | description: Should missing values be included or excluded from the aggregation results. Default is EXCLUDE - enum: - EXCLUDE: Should missing values be excluded from the aggregation results - INCLUDE: Should missing values be included in the aggregation results - name: range | type: RangeAggregation | description: Range aggregation - name: buckets | type: array | description: List of range buckets, where during aggregation each entity will be placed in the first bucket where its value falls into based on provided range bounds - name: from | type: number | description: Inclusive lower bound of the range. Required if to is not given - name: to | type: number | description: Exclusive upper bound of the range. Required if from is not given - name: scalar | type: ScalarAggregation | description: Scalar aggregation - name: type | type: ScalarType | description: Define the operator for the scalar aggregation - enum: - COUNT_DISTINCT: Count of distinct values - MIN: Minimum value - MAX: Maximum value - name: dateHistogram | type: DateHistogramAggregation | description: Date histogram aggregation - name: interval | type: Interval | description: Interval for date histogram aggregation - enum: - YEAR: Yearly interval - MONTH: Monthly interval - WEEK: Weekly interval - DAY: Daily interval - HOUR: Hourly interval - MINUTE: Minute interval - SECOND: Second interval - name: nested | type: NestedAggregation | description: Nested aggregation - name: nestedAggregations | type: array | description: Flattened list of aggregations, where each next aggregation is nested within previous one - ONE-OF: - name: value | type: ValueAggregation | description: Value aggregation - name: range | type: RangeAggregation | description: Range aggregation - name: scalar | type: ScalarAggregation | description: Scalar aggregation - name: dateHistogram | type: DateHistogramAggregation | description: Date histogram aggregation - name: name | type: string | description: User-defined name of aggregation, should be unique, will appear in aggregation results - name: type | type: NestedAggregationType | description: Type of aggregation, client must provide matching aggregation field below - enum: - VALUE: An aggregation where result buckets are dynamically built - one per unique value - RANGE: An aggregation, where user can define set of ranges - each representing a bucket - SCALAR: A single-value metric aggregation - e.g. min, max, sum, avg - DATE_HISTOGRAM: An aggregation, where result buckets are dynamically built - one per time interval (hour, day, week, etc.) - name: fieldPath | type: string | description: Field to aggregate by, use dont notation to specify json path - name: name | type: string | description: User-defined name of aggregation, should be unique, will appear in aggregation results - name: type | type: AggregationType | description: Type of aggregation, client must provide matching aggregation field below - enum: - VALUE: An aggregation where result buckets are dynamically built - one per unique value - RANGE: An aggregation, where user can define set of ranges - each representing a bucket - SCALAR: A single-value metric aggregation - e.g. min, max, sum, avg - DATE_HISTOGRAM: An aggregation, where result buckets are dynamically built - one per time interval (hour, day, week, etc.) - NESTED: Multi-level aggregation, where each next aggregation is nested within previous one - name: fieldPath | type: string | description: Field to aggregate by, use dot notation to specify json path - name: search | type: SearchDetails | description: Free text to match in searchable fields. - name: mode | type: Mode | description: Defines how separate search terms in `expression` are combined - enum: - OR: Any of the search terms must be present - AND: All search terms must be present - name: expression | type: string | description: Search term or expression - name: fields | type: array | description: Fields to search in. If empty - will search in all searchable fields. Use dot notation to specify json path - name: fuzzy | type: boolean | description: Flag if should use auto fuzzy search (allowing typos by a managed proximity algorithm) - name: timeZone | type: string | description: Time zone to adjust date-time-based filters and aggregations, in ISO 8601 (including offsets) or IANA time zone database (including time zone GUIDs) format. Return type: SearchPlansResponse - 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: maxPurchasesPerBuyer | type: integer | description: Maximum number of times the same customer can purchase this plan. Use `0` for unlimited purchases or `1` to limit to one purchase per customer. - 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: 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: CursorPagingMetadata | description: Paging metadata. - name: count | type: integer | description: Number of items returned in the response. - name: cursors | type: Cursors | description: Cursor strings that point to the next page, previous page, or both. - 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. - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page. + `true`: Another page of results can be retrieved. + `false`: This is the last page. ``` ### Examples ### Search Plans ```curl curl -X POST \ 'https://www.wixapis.com/pricing-plans/v3/bulk/plans/search' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "search": { "search": { "expression": "business growth" } } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.pricingPlans.PlanService.searchPlans(search) Description: Retrieves a list of plans that match the provided search query and optionally performs aggregations on the data queried. To learn about working with queries, see [Search, Query and List Methods](https://dev.wix.com/docs/rest/articles/get-started/search-query-and-list-methods.md). # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: search Method parameters: param name: search | type: CursorSearch | 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 - name: aggregations | type: array | description: Logical groupings of data into facets, with summaries for each facet. For example, use aggregations to allow site visitors to narrow down their search results by selecting specific categories. - ONE-OF: - name: value | type: ValueAggregation | description: Value aggregation - ONE-OF: - name: includeOptions | type: IncludeMissingValuesOptions | description: Options for including missing values - name: addToBucket | type: string | description: Can specify custom bucket name. Defaults are [string -> "N/A"], [int -> "0"], [bool -> "false"] ... - name: sortType | type: SortType | description: Should sort by number of matches or value of the field - enum: - COUNT: Should sort by number of matches - VALUE: Should sort by value of the field alphabetically - name: sortDirection | type: SortDirection | description: Should sort in ascending or descending order - enum: - DESC: Should sort in descending order - ASC: Should sort in ascending order - name: limit | type: integer | description: How many aggregations would you like to return? Can be between 1 and 250. 10 is the default. - name: missingValues | type: MissingValues | description: Should missing values be included or excluded from the aggregation results. Default is EXCLUDE - enum: - EXCLUDE: Should missing values be excluded from the aggregation results - INCLUDE: Should missing values be included in the aggregation results - name: range | type: RangeAggregation | description: Range aggregation - name: buckets | type: array | description: List of range buckets, where during aggregation each entity will be placed in the first bucket where its value falls into based on provided range bounds - name: from | type: number | description: Inclusive lower bound of the range. Required if to is not given - name: to | type: number | description: Exclusive upper bound of the range. Required if from is not given - name: scalar | type: ScalarAggregation | description: Scalar aggregation - name: type | type: ScalarType | description: Define the operator for the scalar aggregation - enum: - COUNT_DISTINCT: Count of distinct values - MIN: Minimum value - MAX: Maximum value - name: dateHistogram | type: DateHistogramAggregation | description: Date histogram aggregation - name: interval | type: Interval | description: Interval for date histogram aggregation - enum: - YEAR: Yearly interval - MONTH: Monthly interval - WEEK: Weekly interval - DAY: Daily interval - HOUR: Hourly interval - MINUTE: Minute interval - SECOND: Second interval - name: nested | type: NestedAggregation | description: Nested aggregation - name: nestedAggregations | type: array | description: Flattened list of aggregations, where each next aggregation is nested within previous one - ONE-OF: - name: value | type: ValueAggregation | description: Value aggregation - name: range | type: RangeAggregation | description: Range aggregation - name: scalar | type: ScalarAggregation | description: Scalar aggregation - name: dateHistogram | type: DateHistogramAggregation | description: Date histogram aggregation - name: name | type: string | description: User-defined name of aggregation, should be unique, will appear in aggregation results - name: type | type: NestedAggregationType | description: Type of aggregation, client must provide matching aggregation field below - enum: - VALUE: An aggregation where result buckets are dynamically built - one per unique value - RANGE: An aggregation, where user can define set of ranges - each representing a bucket - SCALAR: A single-value metric aggregation - e.g. min, max, sum, avg - DATE_HISTOGRAM: An aggregation, where result buckets are dynamically built - one per time interval (hour, day, week, etc.) - name: fieldPath | type: string | description: Field to aggregate by, use dont notation to specify json path - name: name | type: string | description: User-defined name of aggregation, should be unique, will appear in aggregation results - name: type | type: AggregationType | description: Type of aggregation, client must provide matching aggregation field below - enum: - VALUE: An aggregation where result buckets are dynamically built - one per unique value - RANGE: An aggregation, where user can define set of ranges - each representing a bucket - SCALAR: A single-value metric aggregation - e.g. min, max, sum, avg - DATE_HISTOGRAM: An aggregation, where result buckets are dynamically built - one per time interval (hour, day, week, etc.) - NESTED: Multi-level aggregation, where each next aggregation is nested within previous one - name: fieldPath | type: string | description: Field to aggregate by, use dot notation to specify json path - name: search | type: SearchDetails | description: Free text to match in searchable fields. - name: mode | type: Mode | description: Defines how separate search terms in `expression` are combined - enum: - OR: Any of the search terms must be present - AND: All search terms must be present - name: expression | type: string | description: Search term or expression - name: fields | type: array | description: Fields to search in. If empty - will search in all searchable fields. Use dot notation to specify json path - name: fuzzy | type: boolean | description: Flag if should use auto fuzzy search (allowing typos by a managed proximity algorithm) - name: timeZone | type: string | description: Time zone to adjust date-time-based filters and aggregations, in ISO 8601 (including offsets) or IANA time zone database (including time zone GUIDs) format. 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: maxPurchasesPerBuyer | type: integer | description: Maximum number of times the same customer can purchase this plan. Use `0` for unlimited purchases or `1` to limit to one purchase per customer. - 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: 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: CursorPagingMetadata | description: Paging metadata. - name: count | type: integer | description: Number of items returned in the response. - name: cursors | type: Cursors | description: Cursor strings that point to the next page, previous page, or both. - 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. - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page. + `true`: Another page of results can be retrieved. + `false`: This is the last page. ``` ### Examples ### searchPlans ```javascript import { plansV3 } from '@wix/pricing-plans'; async function searchPlans(search) { const response = await plansV3.searchPlans(search); }; ``` ### searchPlans (with elevated permissions) ```javascript import { plansV3 } from '@wix/pricing-plans'; import { auth } from '@wix/essentials'; async function mySearchPlansMethod(search) { const elevatedSearchPlans = auth.elevate(plansV3.searchPlans); const response = await elevatedSearchPlans(search); } ``` ### searchPlans (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 searchPlans(search) { const response = await myWixClient.plansV3.searchPlans(search); }; ``` ---