Menu
Documentation
Getting started Install

Install

Install the server SDK from npm and configure the client for your environment.

Use the TypeScript SDK from a trusted backend. A customer integration does not need blockchain RPC credentials, database access, a wallet, or a signing key.

Get the SDK#

The SDK is published to npm as @slicesmoney/sdk:

bash
npm i @slicesmoney/sdk

Install the exact version reviewed for your integration and commit your dependency lockfile. The package has no runtime dependencies, needs Node.js 18 or later (it uses the global fetch), and ships ESM and CommonJS builds with type definitions.

A reviewed tarball supplied for your environment installs the same way, as an alternative to the registry:

bash
# Set this to the reviewed package file provided for your integration.
export SLICES_SDK_TARBALL=/absolute/path/to/the-supplied-sdk.tgz
npm install "$SLICES_SDK_TARBALL"

Configure the client#

ts
import { Slices } from "@slicesmoney/sdk";

const apiKey = process.env.SLICES_API_KEY;
const baseUrl = process.env.SLICES_BASE_URL;

if (!apiKey || !baseUrl) {
  throw new Error("Set SLICES_API_KEY and SLICES_BASE_URL on the server");
}

export const slices = new Slices({ apiKey, baseUrl });

The base URL is the service origin supplied for your integration. It is not the marketing site's URL, and it does not include /v1; the SDK appends API paths.

Use http://localhost:3000 only for loopback development. Remote environments require HTTPS. The client must not follow redirects that could forward credentials to another location.

Keep it server-side#

Import the SDK only in backend modules. Do not include it in a component that executes in a browser or expose its key through client-visible environment variables. Your mobile or web application should call your own authenticated backend; that backend decides whether to issue a reward.

The SDK does not include wallet signing, eligibility checks, reward calculations, or an embedded rewards panel. It is a small client for the Slices server API.

Using another language#

The HTTP API supports ordinary authenticated JSON requests. The API overview and included OpenAPI contract define the same operations used by the TypeScript client.

Installation checks#

Confirm that your application can import Slices, construct a client with the approved origin, and read an authorized campaign. A successful local import proves package installation—not production token support or a sent transfer.

Install @slicesmoney/sdk exactly. Do not substitute an unrelated package with a similar name: the @slices npm scope belongs to another publisher. If the package cannot be installed, request the reviewed tarball or use the HTTP contract directly.

Next: Authentication or Quickstart.