import { Eventop } from '@eventop/sdk';
// Initialize client
const eventop = new Eventop({
apiKey: process.env.EVENTOP_API_KEY!, // sk_test_... or sk_live_...
// environment auto-detected from key prefix
});
// Create checkout session
const session = await eventop.checkout.create({
planId: 'premium-monthly',
customerEmail: 'user@example.com',
customerId: 'user_123',
successUrl: 'https://yourdomain.com/success',
cancelUrl: 'https://yourdomain.com/pricing',
metadata: {
userId: '123',
source: 'web',
},
});
console.log('Checkout URL:', session.url);
// Verify webhook
app.post('/webhooks/eventop', express.raw({ type: 'application/json' }), (req, res) => {
const signature = req.headers['x-webhook-signature'] as string;
const payload = req.body.toString();
try {
const event = eventop.webhooks.constructEvent(
payload,
signature,
process.env.WEBHOOK_SECRET!,
);
console.log('Received event:', event.event);
res.json({ received: true });
} catch (err) {
res.status(400).send('Webhook signature verification failed');
}
});-
Notifications
You must be signed in to change notification settings - Fork 0
eventop-s/sdk
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
SDK for the onchain Solana-based subscription management system that enables recurring crypto payments while maintaining full custody.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published