Adapters
Stripe
Payment processing with Stripe
Setup
import { stripePayment } from "@billsdk/stripe";
payment: stripePayment({
secretKey: process.env.STRIPE_SECRET_KEY!,
webhookSecret: process.env.STRIPE_WEBHOOK_SECRET!,
})Webhooks
Endpoint: /api/billing/webhook
Events to enable:
checkout.session.completed— activates subscriptionpayment_intent.payment_failed— marks as failed
Stripe Dashboard
- Developers → Webhooks → Add endpoint
- URL:
https://your-domain.com/api/billing/webhook - Copy signing secret to
STRIPE_WEBHOOK_SECRET
Local Development
stripe listen --forward-to localhost:3000/api/billing/webhookPayment Modes
| Price | Mode | Behavior |
|---|---|---|
0 | Setup | Collects payment method, no charge |
>0 | Payment | Charges immediately, saves method |
Renewals
await billing.api.processRenewals();
await billing.api.processRenewals({ dryRun: true });
await billing.api.processRenewals({ customerId: user.id });Refunds
await billing.api.createRefund({
paymentId: "...",
amount: 1000, // partial, in cents
});