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 🙏

© 2025 – Pkg Stats / Ryan Hefner

dexchange-api-sdk

v1.0.5

Published

SDK officiel pour intégrer DEXCHANGE-API dans vos applications JavaScript/TypeScript

Readme

DEXCHANGE API TypeScript/JavaScript SDK

Official TypeScript/JavaScript SDK for the DEXCHANGE API. This SDK provides a simple and elegant way to interact with DEXCHANGE's payment services.

Installation

npm install dexchange-api-sdk
# or
yarn add dexchange-api-sdk

Quick Start

import { DexchangeClient } from 'dexchange-api-sdk';

const client = new DexchangeClient({
  apiKey: 'your_api_key',
  // Optional: override base URL
  // baseUrl: 'https://api-m.dexchange.sn'
});

// Initialize a transaction
const initTransaction = async () => {
  try {
    const response = await client.transaction.init({
      externalTransactionId: 'ORDER-123',
      serviceCode: 'OM_SN',
      amount: 1000,
      number: '771234567',
      callBackURL: 'https://your-domain.com/callback',
      successUrl: 'https://your-domain.com/success',
      failureUrl: 'https://your-domain.com/failure',
    });
    console.log(response);
  } catch (error) {
    console.error(error);
  }
};

// Generate a merchant payment link
const createPaymentLink = async () => {
  try {
    const response = await client.transaction.createMerchantPaymentLink({
      externalTransactionId: 'ORDER-123',
      ItemName: 'Premium T-shirt',
      ItemPrice: 5000,
      ClientName: 'John Doe',
      ClientPhone: '771234567',
      Email: '[email protected]',
      callBackURL: 'https://your-domain.com/callback',
      successUrl: 'https://your-domain.com/success',
      failureUrl: 'https://your-domain.com/failure',
    });
    console.log(response);
  } catch (error) {
    console.error(error);
  }
};

// Get account balance
const getBalance = async () => {
  try {
    const response = await client.services.getBalance();
    console.log(response);
  } catch (error) {
    console.error(error);
  }
};

// Get available services
const getServices = async () => {
  try {
    const response = await client.services.getServices();
    console.log(response);
  } catch (error) {
    console.error(error);
  }
};

Available Services

Transaction Service

  • init(data) - Initialize a new transaction
  • confirmWizall(data) - Confirm a Wizall transaction with OTP
  • getTransaction(transactionId) - Get transaction details
  • createMerchantPaymentLink(data) - Generate a merchant payment link
  • getMerchantTransaction(transactionId) - Get merchant transaction details

Services

  • getBalance() - Get current account balance
  • getServices() - Get list of available payment services

Legacy Methods (Backward Compatibility)

The following methods are maintained for backward compatibility:

  • initCashout(data)
  • initCashin(data)
  • initAirtime(data)
  • getStatus(transactionId)

Error Handling

The SDK throws errors for various scenarios including network errors, API errors, and validation errors. Always wrap API calls in try-catch blocks:

try {
  const response = await client.transaction.init({
    // ... transaction details
  });
} catch (error) {
  if (error.response) {
    // The request was made and the server responded with an error
    console.error(error.response.data);
  } else if (error.request) {
    // The request was made but no response was received
    console.error('No response received');
  } else {
    // Something happened in setting up the request
    console.error('Error:', error.message);
  }
}

TypeScript Support

This SDK is written in TypeScript and includes type definitions for all requests and responses. You get full IntelliSense support in compatible IDEs.

Documentation

For detailed API documentation, visit https://docs-api.dexchange.sn

License

MIT