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

sendmate-node

v1.2.0

Published

SendMate Node.js SDK for payment processing and wallet management

Downloads

14

Readme

SendMate Node.js SDK

Official Node.js SDK for the SendMate API. This package provides a simple and efficient way to integrate SendMate's payment processing and wallet management capabilities into your Node.js applications.

Installation

Choose your preferred package manager:

# Using npm
npm install sendmate-node

# Using yarn
yarn add sendmate-node

# Using pnpm
pnpm add sendmate-node

Quick Start

Basic Setup

import { SendMateClient } from 'sendmate-node';

// Initialize the client
const client = new SendMateClient(
    process.env.PUBLISHABLE_KEY,
    process.env.SECRET_KEY,
    process.env.IS_SANDBOX === 'true'
);

Environment Variables

PUBLISHABLE_KEY=your_publishable_key
SECRET_KEY=your_secret_key
IS_SANDBOX=true  # Set to false for production

Examples

1. Wallet Management

// Get all wallets
const wallets = await client.wallet.get_wallets();

// Get wallet details
const walletDetails = await client.wallet.get_wallet('wallet_id');

// Get wallet transactions
const transactions = await client.wallet.get_wallet_transactions('wallet_id', {
    limit: 10,
    page: 1
});

// Set default wallet
const result = await client.wallet.set_default_wallet('wallet_id');

2. M-Pesa STK Push

// Initiate STK Push
const stkPush = await client.mpesa.stk_push({
    phone_number: '254712345678',
    amount: 100,
    currency: 'KES',
    description: 'Payment for goods',
    callback_url: 'https://your-domain.com/callback'
});

// Check STK Push status
const status = await client.mpesa.check_stk_status(stkPush.id);

3. Checkout Sessions

// Create a checkout session
const session = await client.checkout.create_session({
    amount: 1000,
    currency: 'KES',
    description: 'Premium Plan Subscription',
    success_url: 'https://your-domain.com/success',
    cancel_url: 'https://your-domain.com/cancel',
    metadata: {
        order_id: '12345',
        customer_id: '67890'
    }
});

// Get session details
const sessionDetails = await client.checkout.get_session(session.id);

4. Express.js Integration Example

import express from 'express';
import { SendMateClient } from 'sendmate-node';

const app = express();
const client = new SendMateClient(
    process.env.PUBLISHABLE_KEY,
    process.env.SECRET_KEY,
    process.env.IS_SANDBOX === 'true'
);

// M-Pesa STK Push endpoint
app.post('/api/mpesa/stk-push', async (req, res) => {
    try {
        const { phone_number, amount } = req.body;
        
        const stkPush = await client.mpesa.stk_push({
            phone_number,
            amount,
            currency: 'KES',
            description: 'Payment for goods',
            callback_url: 'https://your-domain.com/callback'
        });

        res.json({ success: true, data: stkPush });
    } catch (error) {
        res.status(500).json({ success: false, error: error.message });
    }
});

// Checkout session endpoint
app.post('/api/checkout/session', async (req, res) => {
    try {
        const { amount, description } = req.body;
        
        const session = await client.checkout.create_session({
            amount,
            currency: 'KES',
            description,
            success_url: 'https://your-domain.com/success',
            cancel_url: 'https://your-domain.com/cancel'
        });

        res.json({ success: true, data: session });
    } catch (error) {
        res.status(500).json({ success: false, error: error.message });
    }
});

app.listen(3000, () => {
    console.log('Server running on port 3000');
});

API Documentation

SendMateClient

Constructor

new SendMateClient(publishableKey: string, secretKey: string, isSandbox: boolean)

Wallet Methods

  • get_wallets(): Get all wallets
  • get_wallet(id: string): Get wallet details
  • get_wallet_transactions(id: string, options?: { limit?: number, page?: number }): Get wallet transactions
  • set_default_wallet(id: string): Set default wallet

M-Pesa Methods

  • stk_push(options: { phone_number: string, amount: number, currency: string, description: string, callback_url: string }): Initiate STK Push
  • check_stk_status(id: string): Check STK Push status
  • get_transaction(id: string): Get transaction details

Checkout Methods

  • create_session(options: { amount: number, currency: string, description: string, success_url: string, cancel_url: string, metadata?: object }): Create checkout session
  • get_session(id: string): Get session details
  • expire_session(id: string): Expire a session

Development

# Install dependencies
npm install

# Build the package
npm run build

# Run tests
npm test

# Run linter
npm run lint

License

MIT

Support

For support, email [email protected] or create an issue in the GitHub repository.