One-time + recurring billing + invoices
PayPal REST API billing: one-time orders, monthly/yearly subscription plans, usage-based limits, refunds, HTML invoice generation, and webhook handler. Note: PayPal-only — adapt the patterns for your payment provider of choice.
resend1const sub = await createSubscription('pro_monthly', user.email)2window.location.href = sub.links.find(l => l.rel === 'approve').href3 4var(--text-3);font-style:italic">// Check plan limits:5const limit = await getPlanLimit(userId, 'ai_calls')6if (limit.used >= limit.max) throw new Error('Upgrade required')Short excerpt. Full block includes SQL migrations, error handling, RLS policies, and complete file structure.
One-time · Instant GitHub access
✓Instant GitHub repo access
✓Own the code forever
✓Free updates
✓30-day refund if it breaks