x402-stakefy-react
v2.0.0
Published
React hooks and components for Stakefy x402 - 10x lower fees than competitors, social payments, session budgets
Maintainers
Readme
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:
| Package | Description | NPM |
|---------|-------------|-----|
| 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-reactimport { 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:
Includes:
- All hook APIs
- Error handling
- TypeScript types
- Advanced examples
- Best practices
🔗 Links
- Main Docs: https://github.com/JaspSoe/stakefy-x402
- Core SDK: https://npmjs.com/package/x402-stakefy-sdk
- Express Package: https://npmjs.com/package/stakefy-express
- Facilitator API: https://stakefy-x402-production.up.railway.app
- Twitter: @stakefy
- Email: [email protected]
📄 License
MIT © Stakefy
