> ## 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

> Returns the full Plan struct for a given plan ID, including amount, period, trial settings, grace period, and price ceiling. Read-only, no signature required.

```rust theme={null}
fn get_plan(env: Env, plan_id: u64) -> Plan
```

Returns the full `Plan` struct for the given plan ID. This is a read-only function that queries contract state directly. No transaction signature is required.

***

## Parameters

| Name      | Type  | Description                     |
| --------- | ----- | ------------------------------- |
| `plan_id` | `u64` | The ID of the plan to retrieve. |

***

## Authorization

None. This is a read-only query.

***

## Return value

`Plan` struct with the following fields:

| Field           | Type      | Description                                 |
| --------------- | --------- | ------------------------------------------- |
| `id`            | `u64`     | Unique plan identifier                      |
| `merchant`      | `Address` | Merchant who created the plan               |
| `token`         | `Address` | Token contract address (e.g., USDC)         |
| `amount`        | `i128`    | Amount charged per period (in stroops)      |
| `period`        | `u64`     | Billing period in seconds                   |
| `trial_periods` | `u32`     | Number of free trial periods                |
| `max_periods`   | `u32`     | Max billing periods (0 = unlimited)         |
| `grace_period`  | `u64`     | Grace window in seconds after failed charge |
| `price_ceiling` | `i128`    | Maximum amount the plan can ever charge     |
| `created_at`    | `u64`     | Ledger timestamp at creation                |
| `active`        | `bool`    | Whether the plan accepts new subscribers    |

***

## Error cases

| Code | Name           | Description                              |
| ---- | -------------- | ---------------------------------------- |
| 6    | `PlanNotFound` | No plan exists with the given `plan_id`. |

***

## Examples

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

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

    const plan = await client.getPlan(1);

    console.log("Merchant:", plan.merchant);
    console.log("Amount:", fromStroops(plan.amount), "USDC");
    console.log("Period:", plan.period / 86400, "days");
    console.log("Trial periods:", plan.trialPeriods);
    console.log("Active:", plan.active);
    ```
  </Tab>

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