On-chain recurring billing
Subscriptions
- 1. Open
Subscriber locks in the recipient, amount per period, total periods, and how long each period lasts. The contract stamps an opened_at and starts the clock.
- 2. Wait
One period must elapse before the merchant can pull anything. The countdown on each card shows when the next claim unlocks.
- 3. Claim
Merchant calls claim(), gets one period's worth, counter goes up. Skipped periods accumulate - you can claim several at once if you waited.
- 4. Cancel
Subscriber can stop the stream any time. Unclaimed periods refund in full. Once all periods are claimed the sub auto-completes.
Note: the contract tracks accounting on-chain. Actual XLM moves via the wallet calls beside each step.
Connect a Wallet
Subscriber and merchant are two separate addresses. For a quick demo you can use one wallet for both, but typically these are different parties.
Connect a Wallet to Manage Subscriptions
Subscribers commit to recurring payments. Merchants claim each period as it falls due. Either side can cancel mid-stream.
Open a Subscription
Subscriber commits N XLM per period for M total periods. Pick a short period (e.g. 1 minute) so you can watch claims happen in real time.
Claim or Cancel
Switch the role tab to merchant once a period has elapsed and click Claim. Subscribers can cancel any time before all periods are claimed; unclaimed periods refund.
On-Chain Activity
Every create / claim / cancel call emits a Soroban event. The feed polls the RPC every few seconds.