Environment variables
Never hardcode keys. Always use environment variables:Payment logging (Supabase)
Log every payment to Supabase for the VS Code extension dashboard and analytics:Vercel / Edge deployment
l402-kit works with Vercel Serverless Functions. Note: the in-memory replay store resets on cold starts. For high-traffic APIs, use Redis for replay protection.Docker
User data deletion
Expose a deletion endpoint so users can permanently remove their data. The l402-kit backend includes/api/delete-data out of the box:
Health check endpoint
Always add a free health check so monitoring tools don’t trigger invoice creation:Monitoring
Key metrics to track:- 402 response rate — healthy baseline is high (most callers need to pay)
- Payment verification rate — ratio of paid vs unpaid calls
- Provider latency —
blink.createInvoice()should be < 500ms - Replay attempts — spike indicates token reuse attacks
Performance
- Token verification is O(1) — pure crypto, no DB, no network
- Invoice creation (402 path) calls your Lightning provider API — add a cache if you expect the same endpoint hit repeatedly before payment
- Replay store is in-memory
Set— for multi-instance deployments, swap for Redis