JSPM

@revkeen/sdk

1.20260312.41
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2359
  • Score
    100M100P100Q107743F
  • License MIT

RevKeen API SDK - Stripe-like billing infrastructure for your SaaS

Package Exports

  • @revkeen/sdk

Readme

RevKeen TypeScript SDK

npm version License: MIT

Official TypeScript/Node.js SDK for the RevKeen API — auto-generated from the OpenAPI specification via Hey API.

Installation

npm install @revkeen/sdk
pnpm add @revkeen/sdk
yarn add @revkeen/sdk

Quick Start

import { RevKeen } from '@revkeen/sdk';

const client = new RevKeen({ apiKey: process.env.REVKEEN_API_KEY! });

const customers = await client.customers.list({ limit: 10 });

for (const customer of customers.data) {
  console.log(customer.name, customer.email);
}

Authentication

const client = new RevKeen({ apiKey: process.env.REVKEEN_API_KEY! });
const client = new RevKeen({
  oauth: {
    clientId: process.env.REVKEEN_CLIENT_ID!,
    clientSecret: process.env.REVKEEN_CLIENT_SECRET!,
    scopes: ['customers:read', 'invoices:read'],
  },
});

The SDK handles token acquisition, caching, and automatic refresh. See the OAuth guide for details.

Resources

Every API resource is available as a typed property on the client:

Resource Method examples
client.customers list(), create(), get(), update(), delete()
client.invoices list(), create(), get(), update(), finalize(), send(), void()
client.subscriptions list(), create(), get(), update(), cancel(), pause(), resume()
client.products list(), create(), get(), update(), delete()
client.payments list(), create(), get()
client.checkoutSessions create(), get()
client.discounts list(), create(), get(), update(), delete()
client.creditNotes list(), create(), get()
client.paymentLinks list(), create(), get(), update()
client.paymentMethods list(), get(), detach()
client.webhookEndpoints list(), create(), delete()
client.events list(), get()
client.entitlements list(), check()

Webhook Verification

import { constructEvent, WebhookSignatureVerificationError } from '@revkeen/sdk';

try {
  const event = constructEvent(
    requestBody,
    headers['revkeen-signature'],
    process.env.REVKEEN_WEBHOOK_SECRET!
  );

  switch (event.type) {
    case 'invoice.paid':
      console.log('Invoice paid:', event.data.id);
      break;
  }
} catch (error) {
  if (error instanceof WebhookSignatureVerificationError) {
    console.error('Invalid signature');
  }
}

Error Handling

try {
  const customer = await client.customers.get('cus_nonexistent');
} catch (error) {
  if (error instanceof RevKeen.ApiError) {
    console.error(`API error ${error.statusCode}: ${error.message}`);
  }
}

Configuration

const client = new RevKeen({
  apiKey: process.env.REVKEEN_API_KEY!,
  // Staging environment
  baseUrl: 'https://staging-api.revkeen.com',
  // Custom timeout (ms)
  timeoutInSeconds: 30,
});

Compatibility

  • Runtime: Node.js 18+
  • Package format: ESM and CommonJS
  • TypeScript: Full type definitions included