Skip to main content
Retrieves all active subscriptions for a specific customer, optionally filtered by product or resource.

Query

query GetActiveSubscriptions($input: GetActiveSubscriptionsInput!) {
  getActiveSubscriptions(input: $input) {
    subscriptionId
    status
    startDate
    currentBillingPeriodEnd
    plan {
      refId
      displayName
      product {
        refId
        displayName
      }
    }
    addons {
      addon {
        refId
        displayName
      }
      quantity
    }
    prices {
      billingModel
      billingPeriod
      price {
        amount
        currency
      }
    }
    trialEndDate
  }
}

Parameters

input
GetActiveSubscriptionsInput
required
Input parameters for retrieving active subscriptions

Return Type

Returns an array of CustomerSubscription objects with:
FieldTypeDescription
subscriptionIdStringUnique subscription ID
statusSubscriptionStatusACTIVE or IN_TRIAL
startDateDateTimeWhen subscription started
currentBillingPeriodEndDateTimeCurrent period end
planPlanThe subscribed plan
addons[SubscriptionAddon]Applied addons
prices[Price]Subscription pricing
trialEndDateDateTimeTrial end (if applicable)

Common Use Cases

Check what plan(s) a customer currently has access to.
For products with multiple subscription products, get all active subscriptions.
Show the customer their current subscription in your app.

Example: Check Customer Access

const { data } = await client.query({
  query: GET_ACTIVE_SUBSCRIPTIONS,
  variables: {
    input: { customerId: user.customerId }
  }
});

const subscriptions = data.getActiveSubscriptions;

if (subscriptions.length === 0) {
  // No active subscription - show upgrade prompt
  showUpgradePrompt();
} else {
  const currentPlan = subscriptions[0].plan;
  console.log(`Current plan: ${currentPlan.displayName}`);
}