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

@fluxpay/sdk

v1.0.0

Published

Official FluxPay SDK for JavaScript and TypeScript

Readme

FluxPay SDK - JavaScript/TypeScript

SDK officiel FluxPay pour JavaScript et TypeScript. Communique avec l'API FluxPay via Kong Gateway.

Installation

npm install @fluxpay/sdk
# ou
yarn add @fluxpay/sdk
# ou
pnpm add @fluxpay/sdk

Utilisation Basique

import FluxPay from '@fluxpay/sdk';

// Initialiser le client
const client = new FluxPay({
  apiKey: 'sk_live_...',
  baseURL: 'https://api.fluxpay.com', // Kong Gateway (point d'entrée unique)
  timeout: 30000,
  retries: 3,
  rateLimitRetry: true,
});

// Créer un paiement
const payment = await client.payments.create({
  amount: 5000,
  currency: 'XOF',
  payment_method: 'mobile_money',
  payment_method_details: {
    provider: 'mtn',
    phone_number: '+2250712345678',
  },
  customer: {
    email: '[email protected]',
    name: 'John Doe',
  },
  metadata: {
    order_id: 'order_123',
  },
});

console.log('Payment created:', payment);

Resources Disponibles

Payments

// Créer un paiement
const payment = await client.payments.create({...});

// Récupérer un paiement
const payment = await client.payments.retrieve('pay_123');

// Lister les paiements
const payments = await client.payments.list({ page: 1, page_size: 20 });

// Remboursement
const refund = await client.payments.refund('pay_123', 2500);

Merchants

// Récupérer un marchand
const merchant = await client.merchants.retrieve('merchant_123');

// Dashboard marchand
const dashboard = await client.merchants.dashboard('merchant_123');

Webhooks

// Créer un webhook
const webhook = await client.webhooks.create({
  url: 'https://example.com/webhook',
  events: ['payment.completed', 'payment.failed'],
});

// Valider la signature d'un webhook
const isValid = client.webhooks.verifySignature(
  request.body,
  request.headers['x-fluxpay-signature'],
  webhookSecret
);

Wallet

// Dépôt
const deposit = await client.wallet.deposit('wallet_123', 10000, 'XOF');

// Retrait
const withdrawal = await client.wallet.withdraw('wallet_123', 5000, 'XOF');

// Transactions
const transactions = await client.wallet.transactions('wallet_123');

Ledger (Admin uniquement) ⚠️

Nécessite JWT avec is_staff=true :

// Définir le token JWT
client.setJWTToken('your_jwt_token');

// Initialiser le plan comptable
await client.ledger.accounts.initialize();

// Lister les comptes
const accounts = await client.ledger.accounts.list({ account_type: 'ASSET' });

// Obtenir le solde d'un compte
const balance = await client.ledger.accounts.balance('1001', {
  date: '2025-12-10',
  currency: 'XOF',
});

// Créer une écriture comptable
const journalEntry = await client.ledger.journalEntries.create({
  entry_date: '2025-12-10',
  description: 'Paiement transaction XYZ',
  lines: [
    {
      account_code: '1101',
      debit: 1000.0,
      credit: 0.0,
      description: 'Créance client',
    },
    {
      account_code: '2001',
      debit: 0.0,
      credit: 1000.0,
      description: 'Dette marchand',
    },
  ],
  currency: 'XOF',
});

// Générer un bilan
const balanceSheet = await client.ledger.reports.balanceSheet({
  date: '2025-12-10',
  currency: 'XOF',
});

Gestion des Erreurs

import {
  APIError,
  RateLimitError,
  AuthenticationError,
  PermissionError,
} from '@fluxpay/sdk';

try {
  const payment = await client.payments.create({...});
} catch (error) {
  if (error instanceof RateLimitError) {
    console.log('Rate limit exceeded. Retry after:', error.retryAfter);
  } else if (error instanceof AuthenticationError) {
    console.log('Authentication failed');
  } else if (error instanceof PermissionError) {
    console.log('Insufficient permissions');
  } else if (error instanceof APIError) {
    console.log('API Error:', error.statusCode, error.message);
  }
}

Rate Limiting

Le SDK gère automatiquement les erreurs 429 (Rate Limit) avec retry automatique.

Limites par service :

  • Payments : 50 req/sec, 2000 req/min, 100000 req/hour
  • Merchants : 100 req/min, 5000 req/hour
  • Wallet : 200 req/min, 10000 req/hour
  • Ledger : 30 req/min, 500 req/hour (plus restrictif)

Kong Gateway

⚠️ Important : Le SDK communique exclusivement avec Kong Gateway (https://api.fluxpay.com), qui route les requêtes vers les services backend appropriés.

Toutes les requêtes passent par Kong, qui gère :

  • Authentification (JWT, API Keys)
  • Rate Limiting
  • Routing vers les services
  • Monitoring et logging

Documentation

Support

Licence

MIT