opacus-payment-demo
v1.0.0
Published
OpacusPay USDC micropayment demo - accept crypto payments in your apps
Maintainers
Readme
opacus-payment-demo
💳 Accept USDC micropayments with OpacusPay
Complete payment integration example using Opacus SDK.
💰 Features
- ✅ USDC micropayments ($0.00001 minimum)
- ✅ Real-time payment verification
- ✅ Multiple service tiers
- ✅ Client + Server examples
🚀 Quick Start
Server (Accept Payments)
PRIVATE_KEY=your_key npm startClient (Make Payment)
PRIVATE_KEY=your_key npm run client📝 Example Usage
import { OpacusClient } from 'opacus-sdk';
// Server: Accept payments
const server = new OpacusClient({ network: 'testnet' });
await server.initPayments(usdcAddress);
server.onMessage('payment-request', async (frame) => {
// Verify payment on-chain
const verified = await verifyPayment(frame.payload);
if (verified) {
// Process service
await server.sendMessage(frame.from, result);
}
});
// Client: Make payment
const client = new OpacusClient({ network: 'testnet' });
await client.initPayments(usdcAddress);
await client.paidRequest(serverUrl, {
payment: { to: serviceProvider, amount: '0.001' }
});💡 Use Cases
- API monetization
- Pay-per-use services
- IoT sensor data
- AI model inference
- Content paywalls
🔐 Security
- Payments verified on 0G Chain
- E2E encrypted communication
- Non-custodial (you control keys)
📚 Learn More
📄 License
MIT
