0.0.1 • Published 1 year ago

@pricelever/sdk v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

🕹️ 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