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

@startbutton/node-sdk

v1.0.1

Published

Official Node.js SDK for StartButton Payment API

Readme

StartButton Node.js SDK

Official Node.js SDK for the StartButton Payment API. This SDK provides a clean, type-safe, and developer-friendly interface for integrating StartButton payment services into your Node.js applications.

Features

  • 🚀 TypeScript Support: Full TypeScript support with comprehensive type definitions
  • 🔐 Authentication: Automatic API key management and authentication
  • 🛡️ Security: Built-in webhook signature verification
  • 🔄 Retry Logic: Automatic retry with exponential backoff
  • 📝 Validation: Comprehensive input validation
  • 🧪 Testing: High test coverage with Jest
  • 📚 Documentation: Comprehensive JSDoc documentation

Installation

npm install @startbutton/node-sdk

Quick Start

import { StartButtonSDK } from '@startbutton/node-sdk';

// Initialize the SDK
const sdk = new StartButtonSDK('your-secret-key', {
  environment: 'test' // or 'live'
});

// Initialize a transaction
const transaction = await sdk.transactions.initialize({
  email: '[email protected]',
  amount: 100000, // in kobo (1000 naira)
  currency: 'NGN',
  reference: 'unique-reference-123'
});

console.log('Transaction initialized:', transaction.data);

Configuration

Configuration Options

const sdk = new StartButtonSDK('your-secret-key', {
  environment: 'test', // 'test' or 'live'
  timeout: 30000, // Request timeout in milliseconds
  baseUrl: 'https://api.startbutton.com' // Custom base URL (optional)
});

Note: the SDK does not auto-read environment variables. Pass your secret key and options explicitly when constructing StartButtonSDK.

Core Modules

Transactions

Handle payment transactions and collections.

// Initialize a transaction
const transaction = await sdk.transactions.initialize({
  email: '[email protected]',
  amount: 100000,
  reference: 'unique-reference',
  currency: 'NGN',
  callbackUrl: 'https://your-site.com/callback'
});

// Verify a transaction
const verification = await sdk.transactions.verify('transaction-reference');

Merchants

Access merchant account information.

// Get wallet balance
const balance = await sdk.merchants.getWalletBalance();

Webhooks

Verify and handle webhooks securely.

// Verify webhook signature
const isValid = sdk.webhooks.verifySignature(
  typeof req.body === 'string' ? req.body : req.body.toString('utf8'),
  signature,
  'your-webhook-secret'
);

if (isValid) {
  // Transaction status query
  const webhookData = sdk.webhooks.transactionStatus(req.body.transactionReference);
  console.log('Webhook received:', webhookData);
}

Default headers sent with each request

The SDK automatically sends these headers:

  • Authorization: Bearer
  • Content-Type: application/json
  • User-Agent: /
  • X-SDK-Version:
  • X-SDK-Source: node-sdk

Error Handling

The SDK provides comprehensive error handling with specific error types:

try {
  const transaction = await sdk.transactions.initialize({
    email: 'invalid-email',
    amount: -100
  });
} catch (error) {
  if (error instanceof ValidationError) {
    console.log('Validation failed:', error.errors);
  } else if (error instanceof AuthenticationError) {
    console.log('Authentication failed');
  } else if (error instanceof RateLimitError) {
    console.log('Rate limit exceeded');
  } else {
    console.log('Unexpected error:', error.message);
  }
}

Testing

Run the test suite:

# Run all tests
npm test

# Run tests in watch mode
npm run test:watch

# Run tests with coverage
npm run test:coverage

Development

Building the SDK

# Build for production
npm run build

# Build TypeScript declarations
npm run build:types

# Clean build artifacts
npm run clean

Code Quality

# Lint code
npm run lint

# Fix linting issues
npm run lint:fix

# Format code
npm run format

API Reference

For detailed API documentation, see the API Reference.

License

MIT License - see LICENSE for details.

Support