JSPM

campayjs

1.0.0-beta
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q23379F
  • License MIT

js/ts wrapper for campay api

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (campayjs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    CampayJs

    JS/TS wrapper for Campay API

    Installation

    npm install campayjs

    Usage

    import Campay from 'campayjs'
    
    const campay = new Campay({
      appKey: 'YOUR_API_KEY',
      appSecret: 'YOUR_SECRET',
      baseUrl: 'https://campay.net/api', // will use demo url if not provided
    })
    
    

    Collect payment

    await campay.collect({
      amount: 100,
      currency: 'XAF', // default 
      description: 'Payment for order #1234',
      phone: '2376 xxx xxx', // default
    });

    Get transaction status

    await campay.getTransactionStatus(
      "c61faf9f-d5f3-4a5b-965a-3a91f7c3b6eb"
    );

    Get balance

    await campay.getAppBalance();

    Get transaction history

    await campay.getTransactionHistory(
      "2022-08-01",
      "2025-08-31"
    );
    
    const paymentLink = await campay.getPaymentLink({
      amount: 4,
      currency: "XAF",
      from: "2376 xxx xxx",
      description: "Test",
      reference: "Test collection",
    });
    console.log("payment link: ", paymentLink);

    License

    MIT