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-payment

v1.0.1

Published

Reusable TypeScript module for Telebirr InApp payment integration with Fabric token reuse

Readme

📘 README.md (Developer Documentation)

Telebirr Payment Module

A reusable TypeScript module for integrating Telebirr InApp payments with safe Fabric token reuse.


Installation

npm install telebirr-payment

Environment Setup

Copy .env.example.env and fill in:

BASE_URL=https://developerportal.ethiotelebirr.et:38443/apiaccess/payment/gateway
FABRIC_APP_ID=your-x-app-key
APP_SECRET=your-app-secret
MERCHANT_APP_ID=your-merchant-app-id
MERCHANT_CODE=your-short-code
PRIVATE_KEY_PATH=./keys/private_key.pem
NOTIFY_URL=https://your-domain.com/payment/notify
REDIRECT_URL=https://your-domain.com/redirect

Fabric Token Format

{
  token: "Bearer xxx",
  effectiveDate: "20260124201821",
  expirationDate: "20260124211821"
}

Basic Usage

import { createInAppOrder, FabricToken } from "telebirr-payment";

let storedToken: FabricToken | null = null;

const result = await createInAppOrder(
  { title: "Test Payment", amount: "10.00" },
  storedToken,
);

// IMPORTANT: always store the returned token
storedToken = result.fabricToken;

console.log(result.receiveCode);

Token Handling Rules

  • You must always pass back the last returned fabricToken

  • The module will:

    • Reuse it if valid
    • Refresh it if expired
  • This prevents exceeding Telebirr’s 100 tokens/day limit


Storage Recommendations

You may store the token in:

  • Memory (single-instance apps)
  • Redis
  • Database
  • KV store
  • Secrets manager

The module does not care how you store it.


Errors

  • Network errors → thrown
  • Telebirr business errors → thrown as JSON string
  • Invalid configuration → thrown at startup

What this module does NOT do

  • ❌ Does not store tokens
  • ❌ Does not generate QR images
  • ❌ Does not verify callback signatures
  • ❌ Does not manage databases

Supported Payment Types

  • ✅ InApp (current)
  • ⏳ QuickPay / QR (future extension)
  • ⏳ WebCheckout (future extension)