Documentation Index
Fetch the complete documentation index at: https://vowena.xyz/docs/llms.txt
Use this file to discover all available pages before exploring further.
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
import { VowenaClient, NETWORKS, fromStroops } from "@vowena/sdk";
const client = new VowenaClient({
contractId: NETWORKS.mainnet.contractId,
rpcUrl: NETWORKS.mainnet.rpcUrl,
networkPassphrase: NETWORKS.mainnet.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);
soroban contract invoke \
--id CONTRACT_ID \
--network mainnet \
-- \
get_plan \
--plan_id 1