FlexSub SDK

Cross-chain subscription SDK: Pay from any chain, settle in USDC, instant micropayments.

FlexSub SDK

Created At

HackMoney 2026

Project Description

FlexSub is a TypeScript SDK that enables developers to add flexible subscription payments to any Web3 application.

The Problem: Today's Web3 subscription experience is fragmented. Users have assets scattered across multiple chains, every payment incurs gas fees, and merchants want to receive stablecoins while users hold various tokens.

Our Solution: FlexSub SDK integrates three protocols to solve this:

Arc/Circle USDC - All subscriptions settle in USDC on-chain via Circle's official contracts, giving merchants predictable revenue. LI.FI Cross-Chain - Users can subscribe using any token from any chain. LI.FI handles bridging and swapping automatically. Yellow Network Micropayments - State channels enable instant, gas-less payments perfect for pay-per-use models. Technical Implementation:

Smart contracts deployed on Arbitrum Sepolia Real WebSocket connection to Yellow Network ClearNode Real-time quotes from LI.FI SDK Full TypeScript SDK with modular architecture FlexSub makes Web3 subscriptions as simple as Web2, while preserving the benefits of decentralization.

How it's Made

Tech Stack:

Smart Contracts: Solidity + Foundry, deployed on Arbitrum Sepolia SDK: TypeScript with modular architecture Demo: Next.js 14, React, Wagmi, RainbowKit, Tailwind CSS v4 Blockchain: viem for low-level interactions Partner Technology Integrations:

  1. Circle/Arc (USDC Settlement) The core subscription logic lives in FlexSubManager.sol. Users approve USDC via Circle's official testnet contract, then call subscribe() to create on-chain subscriptions. We use viem's writeContract and waitForTransactionReceipt for transaction management with custom timeout handling for RPC stability.

  2. Yellow Network (Micropayments) We integrated @erc7824/nitrolite SDK to establish real WebSocket connections to Yellow's ClearNode (wss://clearnet-sandbox.yellow.com/ws). The SDK manages state channel lifecycle: connect → open channel → send instant payments → close channel. This enables gas-less micropayments perfect for pay-per-use subscriptions.

  3. LI.FI (Cross-Chain) Using @lifi/sdk, we fetch real-time quotes for cross-chain swaps. Users can pay with any token from Polygon, Optimism, or Base, and LI.FI calculates the optimal bridge route to deliver USDC on Arbitrum.

Notable Hacks:

Implemented timeout wrappers around waitForTransactionReceipt to handle MetaMask RPC instability Used mainnet LI.FI quotes for accurate pricing while simulating execution on testnet Built a unified payment abstraction that normalizes three completely different payment paradigms into one consistent API

background image mobile

Join the mailing list

Get the latest news and updates

FlexSub SDK | ETHGlobal