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 🙏

© 2025 – Pkg Stats / Ryan Hefner

nitro-loyalty-sdk

v1.0.3

Published

[![npm version](https://img.shields.io/npm/v/nitro-loyalty-sdk.svg)](https://www.npmjs.com/package/nitro-loyalty-sdk) [![License](https://img.shields.io/npm/l/nitro-loyalty-sdk.svg)](LICENSE)

Readme

Nitro Loyalty

npm version License

A simple Node.js SDK for interacting with the Nitro Loyalty API, allowing you to retrieve and manage loyalty data programmatically.


Features

  • Easy integration with Nitro Loyalty API
  • Handles authentication using API keys
  • Fully async/await compatible
  • Returns JSON responses

Installation

Install via npm:

npm install nitro-loyalty

Setup Environment Variables

Your Nitro Loyalty API requires public and secret keys. The recommended way to store them is in environment variables.

1. Create a .env file

In the root of your project, create a .env file:

NITRO_LOYALTY_PUBLIC_KEY=your_public_key_here
NITRO_LOYALTY_SECRET_KEY=your_secret_key_here

Replace the placeholders with your actual API keys.

2. Install dotenv

Install the dotenv package to load your environment variables:

npm install dotenv

3. Load .env in your code

At the top of your main file (e.g., index.js):

require("dotenv").config();

Usage

const nitro = require("nitro-loyalty");

async function run() {
  const result = await nitro.getPoints("user123");
  console.log(result);

  const updateResult = await nitro.updatePoints(
    "user123",
    50,
    "txn456",
    "store789",
    200
  );
  console.log(updateResult);
}

run();

API Functions

1. updatePoints(userId, points, transactionId, location, amount)

Updates a user's loyalty points in Nitro Loyalty.

Parameters:

| Name | Type | Required | Description | | --------------- | ------ | -------- | ----------------------------------------- | | userId | string | Yes | Unique identifier of the user | | points | number | Yes | Number of points to add or subtract | | transactionId | string | Yes | Unique transaction identifier | | location | string | Yes | Location for the transaction | | amount | number | Yes | Monetary value associated with the points |

Returns:

  • Success:
{
  "success": true,
  "message": "Points updated successfully",
  "data": { "userId": "12345", "points": 100 }
}
  • Error:
{
  "success": false,
  "error": "Error message here"
}

Usage Example:

const nitro = require("nitro-loyalty");

async function updateUserPoints() {
  const result = await nitro.updatePoints(
    "user123",
    50,
    "txn456",
    "store789",
    200
  );
  console.log(result);
}

updateUserPoints();

2. getPoints(userId)

Retrieves the current loyalty points of a user.

Parameters:

| Name | Type | Required | Description | | -------- | ------ | -------- | ----------------------------- | | userId | string | Yes | Unique identifier of the user |

Returns:

  • Success:
{
  "success": true,
  "data": { "userId": "12345", "points": 150 }
}
  • Error:
{
  "success": false,
  "error": "Error message here"
}

Usage Example:

const nitro = require("nitro-loyalty");

async function getUserPoints() {
  const result = await nitro.getPoints("user123");
  console.log(result);
}

getUserPoints();

Notes

  • Both functions require NITRO_LOYALTY_PUBLIC_KEY environment variable.
  • HMAC signatures are generated automatically for authentication.
  • Errors may occur if API keys are missing, invalid, or if the API returns a server error.

License

MIT © Haider Ali