chipp
TypeScript icon, indicating that this package has built-in type declarations

2.1.3 • Public • Published

💳 Chipp.ai

⚡ Building the pay-per-generation monetization platform for AI applications ⚡

Npm package version npm Documentation Status Npm Twitter

Be sure to sign up for an account and complete Stripe onboarding at https://app.chipp.ai

Installation

npm i chipp

Usage

import Chipp from "chipp";


const chipp = new Chipp({
  apiKey: "your-api-key-from-Chipp-dashboard",
});

// userId needs to come from your database or auth session
let user = await chipp.getUser({ userId: "a-unique-identifier-for-user" });

// If the user is null, the user does not exist in the Chipp system and needs to be created
if (!user) {
  user = await chipp.createUser({ userId: "a-unique-identifier-for-user" });
}

// Get the number of credits remaining for this user
const numChipps = await user.getCredits();

// Deduct credits from this user
await user.deductCredits(1);

// Generate a payment URL where this user can choose their preferred pakcages of credits and buy more.
// Pass in a redirect URL to bring your user back to your app after the user payment succeeds
const url = await user.getPackagesURL({
  returnToUrl: "https://your-app.com/wherever-user-was",
});

Readme

Keywords

none

Package Sidebar

Install

npm i chipp

Weekly Downloads

101

Version

2.1.3

License

ISC

Unpacked Size

11 kB

Total Files

6

Last publish

Collaborators

  • hunterhod
  • andre-chippai