UNPKG

@lalit.fullstackdev/stripe-wrapper

Version:

Simplified Stripe wrapper for Node.js with payments, subscriptions, invoices, products, webhooks, and mobile integration

28 lines (23 loc) 879 B
import Stripe from "stripe"; import createPayments from "./payments.js"; import createCustomers from "./customers.js"; import createSubscriptions from "./subscriptions.js"; import createProducts from "./products.js"; import createInvoices from "./invoices.js"; import createWebhooks from "./webhooks.js"; class StripeWrapper { constructor(secretKey) { if (!secretKey) throw new Error("Stripe secret key is required"); this.stripe = new Stripe(secretKey, { apiVersion: "2023-10-16" }); this.payments = createPayments(this.stripe); this.customers = createCustomers(this.stripe); this.subscriptions = createSubscriptions(this.stripe); this.products = createProducts(this.stripe); this.invoices = createInvoices(this.stripe); this.webhooks = createWebhooks(this.stripe); } raw() { return this.stripe; } } export default StripeWrapper;