> ## Documentation Index
> Fetch the complete documentation index at: https://vowena-dependabot-github-actions-actions-checkout-7.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# get_plan_subscribers

> Returns all active subscription IDs on a given plan. Read-only query requiring no wallet signature. Useful for merchants tracking their subscriber base.

```rust theme={null}
fn get_plan_subscribers(env: Env, plan_id: u64) -> Vec<u64>
```

Returns a vector of all subscription IDs associated with the given plan. This is a read-only function. No transaction signature is required.

***

## Parameters

| Name      | Type  | Description           |
| --------- | ----- | --------------------- |
| `plan_id` | `u64` | The plan ID to query. |

***

## Authorization

None. This is a read-only query.

***

## Return value

`Vec<u64>` - a list of subscription IDs on the plan. Returns an empty vector if the plan has no subscriptions.

***

## Error cases

None. Returns an empty vector if the plan has no subscriptions.

***

## Examples

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    import { VowenaClient, NETWORKS } from "@vowena/sdk";

    const client = new VowenaClient({
      contractId: NETWORKS.testnet.contractId,
      rpcUrl: NETWORKS.testnet.rpcUrl,
      networkPassphrase: NETWORKS.testnet.networkPassphrase,
    });

    const subIds = await client.getPlanSubscribers(1);
    console.log("Subscription IDs on plan 1:", subIds); // e.g., [1, 2, 4, 8]
    console.log("Total subscribers:", subIds.length);

    // Get details for each subscriber
    for (const subId of subIds) {
      const sub = await client.getSubscription(subId);
      console.log(`Sub ${subId}: ${sub.subscriber}, status: ${sub.status}`);
    }
    ```
  </Tab>

  <Tab title="Soroban CLI">
    ```bash theme={null}
    soroban contract invoke \
      --id CONTRACT_ID \
      --network testnet \
      -- \
      get_plan_subscribers \
      --plan_id 1
    ```
  </Tab>
</Tabs>

<Tip>
  This function is useful for building merchant dashboards that show subscriber
  counts and for keeper bots that need to iterate over all subscriptions on a
  plan to find due charges.
</Tip>
