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
    endDate
    effectiveEndDate
    currentBillingPeriodStart
    currentBillingPeriodEnd
    billingPeriod
    additionalMetaData
    customer {
      customerId
      email
    }
    payingCustomer {
      customerId
      email
    }
    plan {
      refId
      displayName
      description
      product {
        refId
        displayName
        downgradePlan {
          refId
          displayName
        }
      }
    }
    addons {
      addon {
        refId
        displayName
      }
      quantity
    }
    prices {
      billingModel
      price {
        billingPeriod
        price {
          amount
          currency
        }
      }
    }
    totalPrice {
      subTotal {
        amount
        currency
      }
      total {
        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
endDateDateTimeEnd date of the subscription
effectiveEndDateDateTimeEffective end date, accounting for cancellation or trial end behavior
currentBillingPeriodStartDateTimeStart date of the current billing period
currentBillingPeriodEndDateTimeCurrent period end
billingPeriodBillingPeriodBilling cadence (e.g. MONTHLY, ANNUALLY)
additionalMetaDataJSONCustom metadata (key-value pairs) attached to the subscription
customerCustomerThe subscription’s customer, including customerId and email
payingCustomerCustomerThe paying customer (for payment delegation scenarios), including customerId and email
planPlanThe subscribed plan, including refId, displayName, description, and nested product with refId, displayName, and downgradePlan
addons[SubscriptionAddon]Applied addons
prices[Price]List of price items, each with billingModel and price (containing billingPeriod and nested price with amount, currency)
totalPriceTotalPriceSimplified total with subTotal and total (each containing amount and currency). Does not account for per-unit quantities, discounts, minimum spend, or usage-based 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}`);
}