How stellar-sub/stellar-subscriptions-contracts works
This repository provides three Soroban contracts for recurring Stellar payments: merchants publish reusable plans, subscribers authorize bounded and revocable subscriptions, and a registry indexes contract activity for dashboards and indexers. The main workflow is subscription authorization followed by merchant-initiated periodic charges, with token transfers and optional registry reporting. The subscription contract also supports pause, resume, cancel, allowance repair, and lookup; plans can be deactivated. Edges reflect the README and excerpted sources; unsampled implementation details are not inferred.
Main entry points: src/lib.rs Subscription contract · src/lib.rs Plan contract · src/lib.rs Registry contract · allowance.rs Allowance manager
Components 13
Billing plans
- Plan contract
contracts/plan/src/lib.rs - Plan storage
contracts/plan/src/storage.rs
Subscription payments
- Subscription contract
contracts/subscription/src/lib.rs - Subscription storage
contracts/subscription/src/storage.rs - Allowance manager
contracts/subscription/src/allowance.rs - Cross-contract clients
contracts/subscription/src/interfaces.rs - Subscription events
contracts/subscription/src/events.rs
Registry and reporting
- Registry contract
contracts/registry/src/lib.rs - Registry storage
contracts/registry/src/storage.rs
Other components
- Subscriber
- Merchant
- Admin
- Stellar token
Connections 18
- Merchant → Plan contract: creates plans
README.md - Merchant → Subscription contract: charges
README.md - Subscriber → Subscription contract: authorizes and manages
README.md - Admin → Plan contract: links registry
contracts/plan/src/lib.rs - Admin → Subscription contract: links contracts
contracts/subscription/src/lib.rs - Admin → Registry contract: sets writers
README.md - Plan contract → Plan storage: reads and writes
contracts/plan/src/lib.rs - Merchant → Registry contract: queries indexes
- Subscription contract → Subscription storage: reads and writes
contracts/subscription/src/lib.rs - Subscription contract → Allowance manager: syncs allowance
contracts/subscription/src/lib.rs - Allowance manager → Stellar token: approves spending
contracts/subscription/src/allowance.rs - Subscription contract → Stellar token: transfers charges
README.md - Subscription contract → Cross-contract clients: uses clients
contracts/subscription/src/lib.rs - Subscription contract → Plan contract: validates plan
contracts/subscription/src/lib.rs - Subscription contract → Registry contract: registers and reports
README.md - Plan contract → Registry contract: registers plans
contracts/plan/src/lib.rs - Subscription contract → Subscription events: publishes events
contracts/subscription/src/lib.rs - Registry contract → Registry storage: reads and writes
contracts/registry/src/lib.rs