npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@recast-sdk/recast-node

v1.2.1

Published

The `recast-node` library provides the a SDK for RecastPay for [NodeJs](https://nodejs.org) applications. The SDK allows for simple management of authorisation to the RecastPay Api via the `RecastClient`, which exposes helper functions for interacting wit

Readme

@recast-sdk/recast-node

The recast-node library provides the a SDK for RecastPay for NodeJs applications. The SDK allows for simple management of authorisation to the RecastPay Api via the RecastClient, which exposes helper functions for interacting with RecastPay API calls.

RecastClient

RecastClient handles authentication token management as well as JWT verification for the various RecastPay JWT types.

Initialisation

To initialise the RecastClient we need to provide the a RecastConfig object to the client, this configuration hold the API key, secret and if you are enabling sandbox mode for the application.

The key and secret must not exposed to the public and are obtained from the API jey section in Recast for Business.

For a NestJs application, the initialisation may look something like this:

import { RecastClient } from '@recast-sdk/recast-node';
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';

@Injectable()
export class RecastService {
  readonly #RecastClient: RecastClient;

  constructor(private readonly configService: ConfigService) {
    this.#RecastClient = new RecastClient({
      key: this.configService.get<string>('RECAST_API_KEY') ?? '',
      secret: this.configService.get<string>('RECAST_API_SECRET') ?? '',
      sandbox: true,
    });
  }
}

Inventory Items

To interact with inventory items, we can call inventoryItem to retrieve the client functionality. inventoryItem is mainly intended for retrieving items and lists of items from the RecastPay API, it can however do simple create and update operations and can be incorporated into a Brand API inventory creation / update process so that changes made are reflected on Recast for Business.

// Depending on you API framework, retrieval of the RecastClient may change.
const recastClient = new RecastClient({
  key: 'yourRecastApiKey',
  secret: 'yourRecastApiSecret',
  sandbox: true,
});

// to get an Item use the Brands item id provided to the RecastPay API with
// the `getById` function
const item = await recastClient.inventoryItem.getById(id, brandId);

// to get a list of items, limited to the first 50 call `getList` function
const items = await recastClient.inventoryItem.getList(brandId);

// to get a list of paginated items, provide the number of items and offset to
// `getList` function
const items = await recastClient.inventoryItem.getList(brandId, { limit: 10; offset: 0 });

// Once you have the metadata provided from the inventory, you can map this with
// data from your database to present the item information as required.

Purchase Intent

To make a purchase via RecastPay, the Brand API needs to generate a Purchase Intent Token, this token is generated for a Brand product and user for a provided Cast Credit value. The generated token can be passed to a front-end client so a secure, verifiable purchase can be made.

// Depending on you API framework, retrieval of the RecastClient may change.
const recastClient = new RecastClient({
  key: 'yourRecastApiKey',
  secret: 'yourRecastApiSecret',
  sandbox: true,
});

// To create a new Purchase Intent, provide the Brands item id, the Brands User
// Id and how many Cast Credits to be changed.
const intent = recastClient.purchaseIntent.create(
  { externalProductId: 'ID-1234', externalUserId: 'user-1234', amount: 120 },
  brandId
);

// The intent can be returned to the client to initiate a secure purchase

Product

product can be called to quickly check if a brand user has access to an item, via the getAccessStatus call. This call does not return an AccessToken, it does however return the hasAccess and product details, as well as purchase details if hasAccess has returned true.

// Depending on you API framework, retrieval of the RecastClient may change.
const recastClient = new RecastClient({
  key: 'yourRecastApiKey',
  secret: 'yourRecastApiSecret',
  sandbox: true,
});