@flight-framework/payments
v0.0.2
Published
Agnostic payments layer for Flight Framework. Choose your processor: Stripe, Paddle, MercadoPago.
Readme
@flight-framework/payments
Payment processing package for Flight Framework with Stripe adapter.
Quick Start
import { createPayments } from '@flight-framework/payments';
import { stripe } from '@flight-framework/payments/stripe';
const payments = createPayments(stripe({
secretKey: process.env.STRIPE_SECRET_KEY,
webhookSecret: process.env.STRIPE_WEBHOOK_SECRET,
}));
// Create checkout session
const session = await payments.createCheckout({
items: [{ name: 'Pro Plan', price: 2999, quantity: 1 }],
successUrl: 'https://example.com/success',
cancelUrl: 'https://example.com/cancel',
});
// Handle webhook
export async function POST(request: Request) {
const payload = await request.text();
const signature = request.headers.get('stripe-signature')!;
const event = payments.handleWebhook(payload, signature);
if (event.type === 'checkout.session.completed') {
// Handle successful payment
}
}License
MIT
