← Back to home

WorldPayX

Decentralized subscription payments using PayPal PYUSD with direct debit & treasury support.

Problem Statement

This project is a decentralized subscription payment protocol built on Ethereum Sepolia, designed to streamline recurring payments using PayPal’s PYUSD stablecoin.The system provides two flexible payment modes:Direct Debit Mode – Users approve the SubscriptionManager contract to pull PYUSD directly from their wallet at each billing interval. This ensures a seamless, automated process for subscriptions without requiring manual transfers.Treasury Mode – Users deposit PYUSD into the Treasury contract, which securely holds their funds. The Treasury also enables future integration with yield-bearing strategies, allowing users to potentially pay their subscriptions from returns instead of principal. The SubscriptionManager and Treasury work together to handle periodic payments on the user’s behalf.The SubscriptionManager contract acts as the core controller of the protocol. It manages:Subscription creation – Users specify the merchant, amount, billing interval, and payment mode (direct debit or Treasury).Payment execution – Once a payment is due, the contract automatically transfers PYUSD to the merchant.Cancellation – Users can cancel anytime, regaining control over unused funds.By anchoring the system around PayPal PYUSD, users and merchants benefit from:Stability – PYUSD is a dollar-backed stablecoin, minimizing volatility in recurring payments.Trust and adoption – As a PayPal-issued stablecoin, PYUSD inspires confidence among mainstream users and businesses.Global reach – Running on Ethereum ensures borderless accessibility and transparency.In summary, this project delivers a fully on-chain subscription payment solution that combines the stability of PayPal PYUSD with the automation and flexibility of decentralized finance. It eliminates intermediaries, supports recurring payments, and introduces an innovative option for yield-powered subscriptions.

Solution

We built this project as a smart contract–driven subscription payment protocol centered around PayPal’s PYUSD stablecoin on Ethereum Sepolia.The system is powered by three main components:SubscriptionManager.solHandles subscription lifecycle (create, execute, cancel).Supports two payment flows: Direct Debit (wallet → merchant) and Treasury Mode (Treasury → merchant).Uses ERC20.transferFrom for direct PYUSD payments and Treasury calls for deposit-based payments.Treasury.solSecure vault for user PYUSD deposits.Tracks balances per subscription ID.Built with extensibility for future yield integration, so returns could offset subscription costs.Front-End Integration (Ethers.js + Sepolia)Users connect with MetaMask.For Direct Debit, the dApp requests a one-time ERC20 approve for SubscriptionManager to spend PYUSD, then calls createSubscription and immediately executePayment (with interval = 0 for direct debit).For Treasury Mode, users approve and deposit PYUSD to the Treasury before creating subscriptions.Stack & ToolsSolidity (v0.8.20) for smart contracts.Foundry for development, deployment, and scripting (forge-std used for broadcast + testing).Ethers.js (v6) for FE interactions.Ethereum Sepolia testnet as deployment and testing environment.Hacky/Notable bitsWe bypassed long waiting intervals for demo purposes by allowing interval = 0 for instant direct debit testing, so subscriptions can be created and executed in a single flow.Treasury deposits initially used a placeholder subId=0, then reassigned — a neat trick to simplify testing without backend.The system is fully FE-driven (no backend), showing how far you can go with just on-chain logic + ethers.js.Why PayPal PYUSD? Choosing PYUSD as the settlement token gave our project real-world appeal. Its stability and PayPal brand trust make it a natural fit for recurring payments, compared to volatile tokens.

Hackathon

ETHGlobal New Delhi

2025

Contributors