PayFlow (also referred to as FlowPay) is a decentralized subscription and recurring payment protocol built on the Stellar network using Soroban smart contracts. It enables trustless, non-custodial recurring billing by allowing users to approve a contract to periodically transfer funds to a merchant.
- Core Technology: Stellar Soroban (Rust), React + TypeScript (Frontend)
- Architecture:
- Smart Contract (
/contract): Handles subscription logic, charging, cancellations, and pay-per-use microtransactions. - Frontend (
/frontend): A React-based dashboard for users to manage subscriptions and for merchants to view revenue/subscribers. - Documentation (
/docs): Comprehensive guides on API, architecture, deployment, and testing.
- Smart Contract (
- Primary Contract:
FlowPayincontract/src/lib.rs. - Key Functions:
initialize(token): Sets the primary SAC token (e.g., XLM).subscribe(user, merchant, amount, interval, ...): Creates a new subscription.charge(user): Triggers a scheduled charge (called externally by a keeper).pay_per_use(user, amount): Instant microtransactions against an active subscription.cancel(user): Deactivates a subscription.batch_charge(users): Optimizes multi-user charging in a single transaction.
- Features: Grace periods, merchant whitelisting, protocol fees, referral tracking, and subscription metadata.
- Framework: Vite + React + TypeScript.
- Blockchain Interaction:
frontend/src/stellar.tsuses@stellar/stellar-sdkand Soroban RPC. - Wallet Support: Freighter Wallet via
useWallethook. - Key Views: Subscriber Dashboard, Merchant Dashboard, Subscription Forms.
- Rust 1.70+ with
wasm32-unknown-unknowntarget. - Soroban CLI.
- Node.js 18+.
- Typecheck Frontend:
npm run typecheck - Build Frontend:
npm run build:frontend - Test Contract:
npm run backend:test - Check Contract:
npm run backend:typecheck
- Build:
cargo build --release --target wasm32-unknown-unknown - Test:
cargo test
- Install Dependencies:
npm install - Development Server:
npm run dev - Build:
npm run build - Test:
npm run test(Vitest) - Lint/Format:
npm run lint/npm run format
- Contract: Idiomatic Rust using
soroban-sdk. Strict use ofno_std. - Frontend: Functional React components with TypeScript. Prefer Vanilla CSS for styling (as seen in
index.css).
- Contract: Comprehensive unit tests in
contract/src/test.rs. Usesoroban-sdk'stestutils. - Frontend: Vitest for unit and component testing. Smoke tests for main application entry points.
- Refer to
CONTRIBUTING.mdfor detailed instructions. - Husky is used for pre-commit/pre-push hooks (linting and type-checking).
contract/src/lib.rs: Entry point for smart contract logic.frontend/src/stellar.ts: Central hub for all Soroban/Stellar interactions.docs/API.md: Detailed contract function documentation.docs/ARCHITECTURE.md: Deep dive into system design and storage strategy.