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.
sub_id.
Parameters
| Name | Type | Description |
|---|---|---|
subscriber | Address | The subscriber’s Stellar address. Must sign the transaction. |
plan_id | u64 | The ID of the plan to subscribe to. |
Authorization
subscribe() contract call and the nested token.approve() call. Soroban’s auth tree bundles both operations into one authorization.
Allowance calculation
The contract calculates the token allowance as:- If
max_periods > 0:periods_for_approval = max_periods - If
max_periods = 0(unlimited):periods_for_approval = 120 - Allowance expiry is capped at 6,000,000 ledgers (~347 days)
price_ceiling, not the current amount. This means the merchant can adjust pricing within the ceiling without requiring re-authorization.
Return value
u64 - the newly created subscription ID.
Events emitted
| Event | Topics | Data |
|---|---|---|
sub_created | subscriber, sub_id, plan_id | Subscription struct |
Error cases
| Code | Name | Description |
|---|---|---|
| 6 | PlanNotFound | No plan exists with the given plan_id. |
| 7 | PlanInactive | The plan is not accepting new subscribers. |
Examples
- SDK
- Soroban CLI
If the plan has trial periods, the subscription starts immediately but billing begins after the trial ends. The
next_billing_time is set to now + (period * (trial_periods + 1)) so the first real charge happens after the trial.