Membership Plans Query
Query operations for membership plans in the Loopwise Admin API
Note: The Loopwise Admin API is currently under development and not yet available for public use. This documentation is provided for preview purposes only.
Overview
The Membership Plans API allows you to retrieve information about subscription options available to students in your school. Each plan has specific features, pricing, and duration settings.
Available Queries
membershipPlans
Returns a paginated list of membership plans for the authenticated school.
Parameters:
| Parameter | Type | Description |
|---|---|---|
filter | AdminMembershipPlanFilter | Filter criteria (see Filtering) |
page | Int | Page number for pagination |
perPage | Int | Number of items per page (default: 20, max: 50) |
limit | Int | Alternative to perPage |
Returns:
- AdminMembershipPlanPage object with:
nodes: Array of AdminMembershipPlan objectscurrentPage: Current page numberhasNextPage: Whether there are more pageshasPreviousPage: Whether there are previous pagesnodesCount: Total number of items in the current pagetotalPages: Total number of pages
Example:
query {
membershipPlans(
filter: {
active: true
},
page: 1,
perPage: 10
) {
nodes {
id
name
description
planType
isLifetime
price
currency
interval
intervalCount
active
visible
createdAt
updatedAt
totalRevenue
subscriptions (
filter: {
planId: { eq: "abc123-983dsf8" }
}
) {
nodes {
id
planId
state
createdAt
}
}
}
currentPage
hasNextPage
hasPreviousPage
nodesCount
totalPages
}
}Membership Plan Object
The AdminMembershipPlan object contains the following fields based on the schema:
| Field | Type | Description |
|---|---|---|
id | String! | Unique identifier |
name | String! | Plan name |
description | String | Plan description |
planType | String! | Plan type. Possible values: recurring, fixed_date, specific_length, lifetime |
isLifetime | Boolean! | Indicates whether this is a lifetime (permanent access) plan |
price | Float! | Price of the plan |
currency | String! | Currency code (e.g., USD, EUR) in ISO 4217 format |
interval | String! | Billing interval (month, year, day) |
intervalCount | Int! | Number of intervals (e.g., 1, 3, 6) |
active | Boolean! | Whether the plan is active |
visible | Boolean! | Whether the plan is visible to students |
createdAt | Int! | When the plan was created |
updatedAt | Int! | When the plan was last updated |
soldItemsCount | Int | Number of sold subscriptions |
totalRevenue | Float | Total revenue generated by this plan |
subscriptions | AdminSubscriptionPage | Paginated list of subscriptions for this plan |
Subscriptions Fields
The AdminMembershipPlan object includes subscription information through the subscriptions field. This returns a paginated list of subscriptions associated with the plan.
| Field | Type | Description |
|---|---|---|
id | String! | Unique identifier for the subscription |
state | String! | Current state of the subscription |
startAt | Int | When the subscription starts |
endAt | Int | When the subscription ends |
currentPeriodStart | Int | Start of current billing period |
currentPeriodEnd | Int | End of current billing period |
isCanceling | Boolean! | Whether the subscription is scheduled for cancellation |
isCancellable | Boolean! | Whether the subscription can be cancelled |
User Information in Subscriptions
Each subscription includes user information through the user field:
| Field | Type | Description |
|---|---|---|
id | String! | User's unique identifier |
name | String | User's full name |
email | String | User's email address |
Subscriptions Filter Parameters
| Parameter | Type | Description |
|---|---|---|
id | StringOperator | Filter by subscription ID |
planId | StringOperator | Filter by subscription plan ID |
state | StringOperator | Filter by subscription state |
Example with filtered subscriptions:
query {
membershipPlans(page: 1, perPage: 10) {
nodes {
id
name
subscriptions (
filter: {
state: {
eq: "active"
}
}
) {
nodes {
id
state
startAt
endAt
currentPeriodStart
currentPeriodEnd
isCanceling
isCancellable
user {
id
name
email
}
}
currentPage
nodesCount
}
}
}
}Detailed Query Structure
Below is a comprehensive view of fields available in the membershipPlans query based on the schema:
query {
membershipPlans(
filter: {
id: { eq: "plan-123" },
active: true,
visible: true
},
page: 1,
perPage: 20
) {
nodes {
id # Unique identifier (String!)
name # Plan name (String!)
description # Plan description (String)
# Plan type
planType # Plan type: recurring, fixed_date, specific_length, lifetime (String!)
isLifetime # Whether this is a lifetime plan (Boolean!)
# Plan pricing details
price # Price amount (Float!)
currency # Currency code (String!)
# Subscription details
interval # Billing interval (String!)
intervalCount # Number of intervals (Int!)
# Plan status
active # Whether the plan is active (Boolean!)
visible # Whether the plan is visible (Boolean!)
# Timestamps
createdAt # When the plan was created (Int!)
updatedAt # When the plan was last updated (Int!)
# Statistics
soldItemsCount # Number of sold subscriptions (Int)
totalRevenue # Total revenue generated (Float)
# Related subscriptions
subscriptions (
filter: {
planId: { eq: "abc123-983dsf8" }
}
) {
# Subscriptions for this plan (AdminSubscriptionPage)
nodes {
id
state
startAt
endAt
currentPeriodStart
currentPeriodEnd
isCanceling
isCancellable
user {
id
name
email
}
}
currentPage
hasNextPage
nodesCount
}
}
# Pagination information
currentPage # Current page number (Int!)
hasNextPage # Whether there are more pages (Boolean!)
hasPreviousPage # Whether there are previous pages (Boolean!)
nodesCount # Number of items in current page (Int!)
totalPages # Total number of pages (Int!)
}
}Filtering
The membershipPlans query accepts a filter parameter of type AdminMembershipPlanFilter. This allows you to narrow down results based on various criteria.
Available Filters
| Filter Field | Type | Description |
|---|---|---|
id | StringOperator | Filter by plan ID |
active | Boolean | Filter by active status |
visible | Boolean | Filter by visibility |
planType | StringOperator | Filter by plan type. Possible values: recurring, fixed_date, specific_length, lifetime |
StringOperator
The StringOperator used in filters has these operations:
| Operation | Description |
|---|---|
eq | Equal to |
neq | Not equal to |
in | In a list of values |
nin | Not in a list of values |
like | Match text values against a pattern using wildcards (case-sensitive) |
Filter Examples
Find active membership plans:
query {
membershipPlans(
filter: {
active: true
}
) {
nodes {
id
name
price
currency
}
nodesCount
}
}Find visible membership plans:
query {
membershipPlans(
filter: {
visible: true
}
) {
nodes {
id
name
price
currency
}
nodesCount
}
}Find membership plans by ID:
query {
membershipPlans(
filter: {
id: { eq: "plan-123" }
}
) {
nodes {
id
name
price
currency
}
nodesCount
}
}Find lifetime membership plans:
query {
membershipPlans(
filter: {
planType: { eq: "lifetime" }
}
) {
nodes {
id
name
planType
isLifetime
price
currency
}
nodesCount
}
}Find recurring or lifetime plans:
query {
membershipPlans(
filter: {
planType: { in: ["recurring", "lifetime"] }
}
) {
nodes {
id
name
planType
}
nodesCount
}
}Find all non-recurring plans:
query {
membershipPlans(
filter: {
planType: { neq: "recurring" }
}
) {
nodes {
id
name
planType
}
nodesCount
}
}