@saas-billkit/core
v0.2.1
Published
Embeddable billing engine for SaaS — subscriptions, credits, usage metering, invoicing
Maintainers
Readme
@saas-billkit/core
Embeddable billing engine for SaaS — subscriptions, credits, usage metering, invoicing, and multi-tenant support.
Installation
npm install @saas-billkit/coreQuick Start
import { SaasBillkit } from '@saas-billkit/core'
import { createPrismaAdapter } from '@saas-billkit/adapter-prisma'
const billkit = new SaasBillkit({
adapter: createPrismaAdapter(prisma),
defaultCurrency: 'usd',
})
// Create a tenant and customer
const tenant = await billkit.tenants.create({ name: 'Acme Inc' })
const customer = await billkit.customers.create(tenant.id, {
email: '[email protected]',
name: 'Jane Doe',
})
// Create a plan and subscribe
const plan = await billkit.plans.create(tenant.id, {
name: 'Pro',
interval: 'month',
price: 2900, // $29.00 in cents
})
await billkit.subscriptions.create(tenant.id, {
customerId: customer.id,
planId: plan.id,
})Documentation
Full documentation available at github.com/MajorAbdullah/saas-billkit
License
MIT
