x402-stakefy-react

React hooks for Stakefy x402 payments on Solana.
🏠 Main Documentation: github.com/JaspSoe/stakefy-x402
📦 Stakefy Ecosystem
This is part of the complete Stakefy payment infrastructure:
| x402-stakefy-sdk | Core SDK |  |
| x402-stakefy-react | React hooks (this package) |  |
| stakefy-express | Express middleware |  |
🚀 Quick Start
npm install x402-stakefy-react x402-stakefy-sdk @solana/wallet-adapter-react
import { usePaywall } from 'x402-stakefy-react';
function PremiumContent() {
const paywall = usePaywall({
contentId: 'premium-article',
amount: 0.01,
merchantId: 'YOUR_WALLET'
});
if (!paywall.hasAccess) {
return (
<button onClick={paywall.unlock} disabled={paywall.paying}>
{paywall.paying ? 'Processing...' : 'Unlock for 0.01 SOL'}
</button>
);
}
return <div>Premium content here!</div>;
}
✨ Available Hooks
- ✅
useStakefyPayment - Simple payments
- ✅
usePaywall - Content paywalls
- ✅
useSessionBudget - Budget management
- ✅
usePaymentChannel - Channel state
- ✅
useUsername - Username resolution
🎯 Examples
Content Paywall
const paywall = usePaywall({
contentId: 'article-123',
amount: 0.01,
merchantId: 'publisher-wallet'
});
Simple Payment
const { pay, loading, error } = useStakefyPayment();
await pay({
amount: 0.5,
merchantId: 'merchant-wallet',
memo: 'Coffee payment'
});
Session Budget
const { session, pay } = useSessionBudget({
budget: 1.0,
duration: 3600,
merchantId: 'merchant-id'
});
📖 Full Documentation
For complete documentation, API reference, and more examples:
👉 Complete Documentation
Includes:
- All hook APIs
- Error handling
- TypeScript types
- Advanced examples
- Best practices
🔗 Links
📄 License
MIT © Stakefy