New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

trustpayway-sdk

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trustpayway-sdk

Official Node.js SDK for interacting with TrustPayWay API (MTN, Orange, etc.)

latest
Source
npmnpm
Version
1.0.7
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

TrustPayWay SDK (Node.js / TypeScript / JavaScript)

A simple, lightweight Node.js SDK for interacting with the TrustPayWay mobile payment API. Supports MTN, Orange, and others.

Built with TypeScript. Usable in both TypeScript and plain JavaScript projects.

🚀 Features

  • 🔐 Authenticate via application token
  • 💸 Initiate payments (MTN & Orange supported)
  • 📊 Check payment status
  • 🧩 Fully typed for TypeScript support
  • ⚙️ Works in any Node.js project (TS or JS)

📦 Installation

npm install trustpayway-sdk

🧑‍💻 Usage

▶️ TypeScript Example

import { TrustPayWay } from 'trustpayway-sdk';

const tpw = new TrustPayWay({
  baseUrl: 'https://mobilewallet.trustpayway.com',//https://test.trustpayway.com (for testing purposes)
  appToken: 'your-app-token',
  authToken: 'your-bearer-token',
  network: 'orange', // or 'mtn'
});

async function run() {
  const result = await tpw.processPayment({
    amount: '100',
    currency: 'XAF',
    phone: '237600000000',
    description: 'Invoice #123',
    orderId: 'TPW-123',
    notifUrl: 'https://webhook.site/your-webhook',
  });

  console.log('Transaction Response:', result);
}

💡 JavaScript (Vanilla Node.js) Example

const { TrustPayWay } = require('trustpayway-sdk');

const tpw = new TrustPayWay({
  baseUrl: 'https://mobilewallet.trustpayway.com',//https://test.trustpayway.com (for testing purposes)
  appToken: 'your-app-token',
  authToken: 'your-bearer-token',
  network: 'mtn', // or 'orange'
});

async function run() {
  try {
    const result = await tpw.processPayment({
      amount: '100',
      currency: 'XAF',
      phone: '237600000000',
      description: 'Invoice #123',
      orderId: 'TPW-123',
      notifUrl: 'https://webhook.site/your-webhook',
    });

    console.log('Transaction Response:', result);
  } catch (error) {
    console.error('Payment Failed:', error);
  }
}

run();

📚 API Reference

new TrustPayWay(config)

Create a new SDK instance.

Parameters:

  • baseUrl (string): API base URL (e.g. https://mobilewallet.trustpayway.com)
  • appToken (string): Your application token from TrustPayWay
  • authToken (string): Authorization token (Bearer)
  • network (string): 'mtn' or 'orange'

getToken(): Promise<string>

Fetches a session token from TrustPayWay. Automatically called before processPayment() or checkPaymentStatus() if not already set.

processPayment(params): Promise<object>

Initiates a payment via mobile money.

Params:

  • amount (string): Amount to charge
  • currency (string): e.g. 'XAF'
  • phone (string): Receiver phone (with country code)
  • description (string): Description for the transaction example Your APP Name
  • orderId (string): Unique order identifier
  • notifUrl (string): Callback URL for status updates

checkPaymentStatus({ transactionId }): Promise<object>

Checks the status of a transaction.

Params:

  • transactionId (string): The transaction ID returned by processPayment

📄 License

MIT

Keywords

trustpayway

FAQs

Package last updated on 02 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts