JSPM

@saas-billkit/react

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

React hooks and components for SaaS BillKit

Package Exports

  • @saas-billkit/react

Readme

@saas-billkit/react

React hooks and components for SaaS BillKit. Provides ready-to-use hooks for plans, subscriptions, credits, usage, and invoices.

Installation

npm install @saas-billkit/react @saas-billkit/core react

Quick Start

import { BillkitProvider, usePlans, useSubscription } from '@saas-billkit/react'

function App() {
  return (
    <BillkitProvider config={{ baseUrl: '/api/billing' }}>
      <BillingPage />
    </BillkitProvider>
  )
}

function BillingPage() {
  const { plans, loading } = usePlans()
  const { subscription } = useSubscription(customerId)
  const { balance } = useCreditBalance(customerId)

  if (loading) return <div>Loading...</div>
  return (
    <div>
      {plans.map((p) => (
        <div key={p.id}>{p.name}</div>
      ))}
    </div>
  )
}

Documentation

Full documentation available at github.com/MajorAbdullah/saas-billkit

License

MIT