Skip to main content

Installation

The SDK can be installed with either npm, pnpm, bun or yarn package managers.
pnpm add @winwinkit/sdk

Example

import { WinWinKit } from "@winwinkit/sdk";

const wwk = new WinWinKit({
  apiKey: process.env['WINWINKIT_API_KEY']!,
})

// Create or update user.
const { user, errors } = await wwk.createOrUpdateUser({
  appUserId: "821fae4b5-1a2d-4c1e-9152-5297086a161c"
})

...

// Fetch user
const { user, errors } = await wwk.fetchUser({
  appUserId: "821fae4b5-1a2d-4c1e-9152-5297086a161c"
})

...

// Claim code
const { user, rewardsGranted, errors } = await wwk.claimCode({
  appUserId: "821fae4b5-1a2d-4c1e-9152-5297086a161c",
  code: "XYZ123"
})

...

// Withdraw credits
const { user, withdrawResult, errors } = await wwk.withdrawCredits({
  appUserId: "821fae4b5-1a2d-4c1e-9152-5297086a161c",
  key: "key",
  amount: 10
})

...

// Fetch offer code
const { offerCode, subscription, errors } = await wwk.fetchOfferCode({
  offerCodeId: "123e4567-e89b-12d3-a456-426614174000",
})

Check out the SDK on GitHub
I