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

telebirr-ussd

v1.0.1

Published

A Node.js/TypeScript package for integrating with Telebirr USSD APIs.

Downloads

8

Readme

🚀 And that's it. Do your thing and Give us a star if this helped you.🚀

Telebirr USSD Node.js Client

A Node.js client library for interacting with the Telebirr USSD payment service. This package provides a simple and type-safe way to integrate Telebirr USSD payments into your Node.js applications.

Features

  • TypeScript support with full type definitions
  • Push and pull payment operations
  • Payment status checking
  • Automatic retries for failed requests
  • Comprehensive error handling
  • Configurable logging
  • Input validation
  • Promise-based API

Installation

npm install telebirr-ussd

Quick Start

import { TelebirrUSSD } from 'telebirr-ussd';

// Create a new client instance
const client = new TelebirrUSSD({
  baseURL: 'https://api.ethiotelecom.et',
  apiKey: 'your-api-key',
});

// Initiate a push payment
const response = await client.push({
  amount: 100,
  phone: '0912345678',
  reference: 'ORDER-123',
  description: 'Payment for order #123',
});

console.log('Payment initiated:', response);

Configuration

The client accepts the following configuration options:

interface TelebirrConfig {
  baseURL: string; // Base URL for the API
  apiKey: string; // Your API key
  timeout?: number; // Request timeout in milliseconds (default: 30000)
  maxRetries?: number; // Maximum number of retries (default: 3)
  retryDelay?: number; // Delay between retries in milliseconds (default: 1000)
}

API Reference

Push Payment

Initiate a push payment request to a customer's phone number.

async push(request: PushRequest): Promise<PushResponse>

interface PushRequest {
  amount: number;       // Payment amount
  phone: string;        // Recipient's phone number
  reference: string;    // Unique reference number
  description?: string; // Optional payment description
}

Pull Payment

Initiate a pull payment request from a customer's phone number.

async pull(request: PullRequest): Promise<PullResponse>

interface PullRequest {
  amount: number;       // Payment amount
  phone: string;        // Customer's phone number
  reference: string;    // Unique reference number
  description?: string; // Optional payment description
}

Check Payment Status

Check the status of a payment using its reference number.

async status(request: StatusRequest): Promise<StatusResponse>

interface StatusRequest {
  reference: string;    // Payment reference number
}

Error Handling

The client uses a custom error class TelebirrRequestError for all API-related errors. You can catch and handle these errors in your application:

try {
  const response = await client.push({
    amount: 100,
    phone: '0912345678',
    reference: 'ORDER-123',
  });
} catch (error) {
  if (error instanceof TelebirrRequestError) {
    console.error('Payment failed:', error.message);
  }
}

Input Validation

The client includes built-in validation for all input parameters:

  • Phone numbers must be valid Ethiopian mobile numbers (starting with 09)
  • Amounts must be greater than 0 and not exceed 1,000,000 ETB
  • Reference numbers must be between 3 and 50 characters and contain only letters, numbers, underscores, and hyphens

Logging

The client includes a built-in logger that can be configured to output debug information:

import { Logger, LogLevel } from 'telebirr-ussd';

// Configure the logger
const logger = new Logger({
  level: LogLevel.DEBUG,
  prefix: '[MyApp]',
  enableConsole: true,
});

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.