This guide uses the Vowena TypeScript SDK. You’ll need Node.js 18+ and a Stellar testnet account with USDC. You can get testnet USDC from the Stellar Laboratory.
Create a Client
Initialize the
VowenaClient with your network configuration.- Testnet
- Mainnet
- Custom RPC
NETWORKS.testnet provides pre-configured values for contractId, rpcUrl, networkPassphrase, and usdcAddress so you don’t need to look them up.Create a Plan (Merchant)
Define a subscription plan. This is an on-chain transaction that stores the plan parameters permanently.
USDC on Stellar uses 7 decimal places (stroops), matching the native XLM precision.
What does toStroops do?
What does toStroops do?
toStroops("9.99") converts a human-readable amount to the 7-decimal-place integer format used by Stellar tokens. It returns a BigInt:Subscribe (Subscriber)
A subscriber authorizes the plan. This single transaction calls
subscribe() on the Vowena contract and sets the SEP-41 token allowance - one signature covers both.Charge (Keeper / Anyone)
Once a billing period has elapsed, anyone can trigger the charge. The contract validates all conditions on-chain.The contract checks:
- Is the subscription active?
- Has enough time passed since the last charge?
- Is the trial period over?
- Does the subscriber have sufficient balance and allowance?
- Has the max period limit been reached?
transfer_from().You don’t need to run your own keeper. The Vowena Dashboard includes a built-in keeper service, or you can use third-party keeper networks.
Cancel
Either the subscriber or the merchant can cancel a subscription at any time.
Cancellation is immediate and on-chain. No approval from the merchant is needed. The subscriber can also cancel directly through any Stellar wallet or block explorer that supports Soroban contract invocations - the Vowena frontend is not required.
Full Example
Here’s the complete flow in a single script:Next Steps
Core Concepts
Understand plans, subscriptions, allowances, and the billing lifecycle in depth.
How It Works
Visual walkthrough of the full protocol flow - from plan creation to cancellation.
SDK Reference
Complete SDK documentation with all methods, types, and configuration options.
Run a Keeper
Set up an automated keeper bot to charge subscriptions on schedule.