JSPM

@pricelever/sdk

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q21426F
  • License MIT

The Price Lever TypeScript SDK

Package Exports

  • @pricelever/sdk
  • @pricelever/sdk/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@pricelever/sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

đŸ•šī¸ Price Lever TypeScript SDK

Sign up for a free account at Price Lever to get started.

Installation

npm install @pricelever/sdk

Usage

// Import the SDK
import { PriceLever } from "@pricelever/sdk";

// Initialize the SDK
const pl = new PriceLever({
  publicKey: "your-public-key",
  customer: {
    uid: "your-customers-uid",
    email: "your-customer@email.com",
    // Needs to match the packaging ID
    // in your Price Lever Console
    packagingId: "your-packaging-id",
  },
});

// Check if your customer can use a feature
const canUse: boolean = await pl.canUse("your-feature-id");

// Wrap your feature in React
return (<> { canUse ? <YourFeature /> : <YourUpgrade /> } </>);

// Track engagement for Wallet and Metric features
const receipt = await pl.track("your-feature-id", { used: '01:00:00' });

License

MIT