JSPM

@saas-billkit/core

0.2.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q30883F
  • License MIT

Embeddable billing engine for SaaS — subscriptions, credits, usage metering, invoicing

Package Exports

  • @saas-billkit/core
  • @saas-billkit/core/testing

Readme

@saas-billkit/core

Embeddable billing engine for SaaS — subscriptions, credits, usage metering, invoicing, and multi-tenant support.

Installation

npm install @saas-billkit/core

Quick 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: 'user@acme.com',
  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