New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@startsimpli/billing

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@startsimpli/billing

Universal billing integration for StartSimpli Next.js apps

latest
npmnpm
Version
0.4.8
Version published
Maintainers
1
Created
Source

@startsimpli/billing

Universal billing integration for StartSimpli Next.js apps. Products and pricing are configured in Django admin — frontend components auto-fetch and render.

Backend Setup

The billing backend lives in start-simpli-api/apps/billing/. Models, admin, and API are already configured.

Key Endpoints

EndpointMethodAuthDescription
/api/v1/billing/products/GETPublicList public products with offers
/api/v1/billing/products/{slug}/GETPublicGet product by slug
/api/v1/billing/offer-checkout/POSTRequiredCreate checkout session
/api/v1/billing/offer-portal/POSTRequiredCreate portal session
/api/v1/billing/subscription/current/GETRequiredGet current user's subscription

Admin Workflow

  • Add a BillingProviderCredential (Stripe secret key + webhook secret)
  • Create a BillingProduct (slug = identifier used by frontend)
  • Add ProductOffer inlines (pricing tiers)
  • Use "Sync to provider" admin action to push to Stripe

Frontend Setup

Installation

In your Next.js app's package.json:

{
  "dependencies": {
    "@startsimpli/billing": "workspace:*"
  }
}

Add transpilePackages: ['@startsimpli/billing'] to next.config.js.

Usage

import { BillingProvider, PricingPage, useCheckout, ManageSubscription } from '@startsimpli/billing'

// Wrap your app (or a subtree) with BillingProvider
<BillingProvider apiBaseUrl="/api/v1" authToken={accessToken}>
  <PricingPage productId="raise-simpli" onSelectOffer={handleSelect} />
</BillingProvider>

// Checkout hook
const { checkout, loading } = useCheckout()
await checkout({ offerId, successUrl, cancelUrl })

// Subscription management
<ManageSubscription returnUrl="/settings" buttonText="Manage Billing" />

Components

ComponentPropsDescription
BillingProviderapiBaseUrl, authTokenContext provider — required wrapper
PricingPageproductId, onSelectOffer?Full pricing display with offer cards
PricingSectionproductId, onSelectOffer?Pricing section component
PricingDetailPageproductId, onSelectOffer?Detailed pricing page
UpgradeModalproductId, open, onClose, onSelectOffer?Modal pricing overlay
ManageSubscriptionreturnUrl, buttonText?Portal redirect button
SubscriptionManagerproductId?Full subscription management interface

Hooks

HookReturnsDescription
useProduct(slug){ product, loading, error }Fetch product + offers
useCheckout(){ checkout, subscribeFree, loading, error }Create checkout session or free subscription
usePortal(){ openPortal, loading, error }Open customer portal
useSubscription(){ subscription, loading, error, refetch }Get current user's subscription

Architecture

  • Provider-agnostic: BaseBillingProviderStripeBillingProvider (extensible to Paddle, etc.)
  • BillingProviderFactory: Resolves credentials per-team with global fallback
  • BillingService: Orchestrates sync, checkout, and portal operations
  • ProductOffer: Supports flat, per_seat, tiered, volume, and usage pricing models

Integration with @startsimpli/auth

The billing package integrates seamlessly with @startsimpli/auth:

import { BillingProvider } from '@startsimpli/billing'
import { useAuth } from '@startsimpli/auth'

function App() {
  const { tokens } = useAuth()

  return (
    <BillingProvider
      apiBaseUrl={process.env.NEXT_PUBLIC_API_URL + '/api/v1'}
      authToken={tokens?.access}
    >
      {/* Your app */}
    </BillingProvider>
  )
}

Environment Variables

NEXT_PUBLIC_API_URL=https://api.startsimpli.com

Backend requires:

STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...

Tests

# Frontend tests (39 tests)
cd packages/billing
npm test

# Backend tests (184 tests)
cd start-simpli-api
docker-compose -f docker-compose.local.yml exec -T django pytest apps/billing/tests/ -v

Development

# Type checking
npm run type-check

# Watch mode for tests
npm run test:watch

# Coverage report
npm run test:coverage

Keywords

billing

FAQs

Package last updated on 16 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts