> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# QuerySubscriptions

# Package: base44

# Namespace: Subscriptions

# Method link: https://dev.wix.com/docs/api-reference/business-management/payments/base44/subscriptions/query-subscriptions.md

## Permission Scopes:
Manage Base44 Payments                                                                                          : SCOPE.PAYMENTS.BASE44

## Introduction

Retrieves a list of up to 100 subscriptions, given the provided filtering.

Query Subscriptions requires a filter on `id`, and returns all matching subscriptions in a single page. Sorting isn't supported, and neither is continuing with a cursor: you can set `query.cursorPaging.limit`, but not `query.cursorPaging.cursor`. The response always has `pagingMetadata.hasNext` set to `false`.

Use one of these filters:

- `{"id": {"$in": ["<subscription-id-1>", "<subscription-id-2>"]}}`: Up to 100 unique subscription IDs.
- `{"id": {"$eq": "<subscription-id>"}}`: A single subscription ID.

IDs that don't match a subscription of the site are left out of the response, instead of causing an error. If you specify `query.cursorPaging.limit`, it must be at least the number of requested IDs.

To learn about working with Query methods, see [API Query Language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language.md), [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md), and [Field Projection](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-field-projection.md).

---

## REST API

### Schema

```
 Method: querySubscriptions
 Description: Retrieves a list of up to 100 subscriptions, given the provided filtering.  Query Subscriptions requires a filter on `id`, and returns all matching subscriptions in a single page. Sorting isn't supported, and neither is continuing with a cursor: you can set `query.cursorPaging.limit`, but not `query.cursorPaging.cursor`. The response always has `pagingMetadata.hasNext` set to `false`.  Use one of these filters:  - `{"id": {"$in": ["<subscription-id-1>", "<subscription-id-2>"]}}`: Up to 100 unique subscription GUIDs. - `{"id": {"$eq": "<subscription-id>"}}`: A single subscription GUID.  GUIDs that don't match a subscription of the site are left out of the response, instead of causing an error. If you specify `query.cursorPaging.limit`, it must be at least the number of requested GUIDs.  To learn about working with Query methods, see [API Query Language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language.md), [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md), and [Field Projection](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-field-projection.md).
 URL: https://www.wixapis.com/payments/base44/v1/subscriptions/query
 Method: POST
 Method parameters:
   param name: query | type: CursorQuery    
     - 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.  | validation: minimum 0, maximum 100, format int32
        - 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.  | validation: maxLength 16000
        - name: filter | type: object | description: Filter object in the following format: `"filter" : { "fieldName1": "value1", "fieldName2":{"$operator":"value2"} }` Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`  
        - name: sort | type: array<Sorting> | description: Sort object in the following format: `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`  | validation: maxItems 5
           - name: fieldName | type: string | description: Name of the field to sort by.  | validation: maxLength 512
           - name: order | type: SortOrder | description: Sort order.  
                 - enum: ASC, DESC
 Query fields:
   - field: id | operators: $eq, $in | sort: none | aggregatable: undefined | searchable: undefined
 Return type: QuerySubscriptionsResponse
  - name: subscriptions | type: array<Subscription> | description: Subscriptions that match the requested GUIDs, in the order of the requested GUIDs.  
     - name: id | type: string | description: Subscription GUID.  This is the GUID of the eCom subscription contract, not an GUID from the billing system.  | read-only: true | validation: format GUID
     - name: status | type: Status | description: Subscription status.  | read-only: true 
         - enum:
         -     UNKNOWN: Unknown subscription status. The status isn't recognized or isn't mapped.
         -     ACTIVE: Subscription is active.
         -     CANCELED: Subscription was canceled.
         -     ENDED: Subscription ended after completing its billing cycles.
         -     PAUSED: Subscription is paused.
         -     PENDING: Subscription is pending activation.
     - name: nextBillingDate | type: string | description: Date and time of the next billing cycle.  Returned only when the subscription has an upcoming billing date.  | read-only: true | validation: format date-time
     - name: cancellationDate | type: string | description: Date and time the subscription is scheduled to end.  Returned only after a soft cancellation, which turns off auto-renewal. In that case, it's the date of the next billing cycle.  | read-only: true | validation: format date-time
  - name: pagingMetadata | type: CursorPagingMetadata | description: Metadata for the returned page. All matches are returned in a single page.  
     - name: count | type: integer | description: Number of items returned in the response.  | validation: format int32
     - 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.  | validation: maxLength 16000
        - name: prev | type: string | description: Cursor pointing to the previous page in the list of results.  | validation: maxLength 16000
     - 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

### Query subscriptions by ID
Retrieves the subscriptions that match a list of subscription IDs.

```curl
curl -X POST \
'https://www.wixapis.com/payments/base44/v1/subscriptions/query' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "query": {
    "filter": {
      "id": {
        "$in": [
          "8f1c2a64-5b7e-4d39-9a0e-3c6d1b72e4f5",
          "c4e9a7d2-1f03-4b8a-86d5-0e2b9a41f7c3"
        ]
      }
    },
    "cursorPaging": {
      "limit": 10
    }
  }
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.payments.subscriptions.querySubscriptions(query)
 Description: Retrieves a list of up to 100 subscriptions, given the provided filtering.  Query Subscriptions requires a filter on `id`, and returns all matching subscriptions in a single page. Sorting isn't supported, and neither is continuing with a cursor: you can set `query.cursorPaging.limit`, but not `query.cursorPaging.cursor`. The response always has `pagingMetadata.hasNext` set to `false`.  Use one of these filters:  - `{"id": {"$in": ["<subscription-id-1>", "<subscription-id-2>"]}}`: Up to 100 unique subscription GUIDs. - `{"id": {"$eq": "<subscription-id>"}}`: A single subscription GUID.  GUIDs that don't match a subscription of the site are left out of the response, instead of causing an error. If you specify `query.cursorPaging.limit`, it must be at least the number of requested GUIDs.  To learn about working with Query methods, see [API Query Language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language.md), [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md), and [Field Projection](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-field-projection.md).
 # 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: SubscriptionQuery   | 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.  | validation: minimum 0, maximum 100, format int32
        - 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.  | validation: maxLength 16000
        - name: filter | type: object | description: Filter object in the following format: `"filter" : { "fieldName1": "value1", "fieldName2":{"$operator":"value2"} }` Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`  
        - name: sort | type: array<Sorting> | description: Sort object in the following format: `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`  | validation: maxItems 5
           - name: fieldName | type: string | description: Name of the field to sort by.  | validation: maxLength 512
           - name: order | type: SortOrder | description: Sort order.  
                 - enum: ASC, DESC
 Query fields:
   - field: _id | operators: $eq, $in | sort: none | aggregatable: undefined | searchable: undefined
 Return type: PROMISE<QuerySubscriptionsResponse>
  - name: subscriptions | type: array<Subscription> | description: Subscriptions that match the requested GUIDs, in the order of the requested GUIDs.  
     - name: _id | type: string | description: Subscription GUID.  This is the GUID of the eCom subscription contract, not an GUID from the billing system.  | read-only: true | validation: format GUID
     - name: status | type: Status | description: Subscription status.  | read-only: true 
         - enum:
         -     UNKNOWN: Unknown subscription status. The status isn't recognized or isn't mapped.
         -     ACTIVE: Subscription is active.
         -     CANCELED: Subscription was canceled.
         -     ENDED: Subscription ended after completing its billing cycles.
         -     PAUSED: Subscription is paused.
         -     PENDING: Subscription is pending activation.
     - name: nextBillingDate | type: Date | description: Date and time of the next billing cycle.  Returned only when the subscription has an upcoming billing date.  | read-only: true 
     - name: cancellationDate | type: Date | description: Date and time the subscription is scheduled to end.  Returned only after a soft cancellation, which turns off auto-renewal. In that case, it's the date of the next billing cycle.  | read-only: true 
  - name: pagingMetadata | type: CursorPagingMetadata | description: Metadata for the returned page. All matches are returned in a single page.  
     - name: count | type: integer | description: Number of items returned in the response.  | validation: format int32
     - 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.  | validation: maxLength 16000
        - name: prev | type: string | description: Cursor pointing to the previous page in the list of results.  | validation: maxLength 16000
     - 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

### Query subscriptions by ID
Retrieves the subscriptions that match a list of subscription IDs.

```javascript
import { subscriptions } from "@wix/payments";

async function querySubscriptions() {
  const response = await subscriptions.querySubscriptions(
    {
      filter: { id: { $in: ["8f1c2a64-5b7e-4d39-9a0e-3c6d1b72e4f5", "c4e9a7d2-1f03-4b8a-86d5-0e2b9a41f7c3"] } },
      cursorPaging: { limit: 10 },
    },
  );
}

/* Promise resolves to:
 * {
 *   "subscriptions": [
 *     {
 *       "_id": "8f1c2a64-5b7e-4d39-9a0e-3c6d1b72e4f5",
 *       "status": "ACTIVE",
 *       "nextBillingDate": "2026-12-01T09:00:00.000Z"
 *     }
 *   ],
 *   "pagingMetadata": {
 *     "count": 1,
 *     "hasNext": false
 *   }
 * }
 */

```

### querySubscriptions (self-managed)
Self-managed 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 { subscriptions } from '@wix/payments';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { subscriptions },
  // Include the auth strategy and host as relevant
});


async function querySubscriptions(query) {
  const response = await myWixClient.subscriptions.querySubscriptions(query);
};
```

---