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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@eversend/node-sdk

v1.1.0

Published

Nodejs SDK for Eversend payments API

Downloads

18

Readme

Eversend Nodejs SDK

NPM version Build Status Dependencies

Nodejs SDK for Eversend payments API

Table of Contents

  1. Installation
  2. Initialization
  3. Usage
  4. Contribution Guidelines
  5. License

Installation

$ npm install --save @eversend/node-sdk

Initialization

const eversendClient = require('@eversend/node-sdk')
    ({clientId: "clientId", clientSecret: "clientSecret"});

You can get your clientId and clientSecret from the settings section in the dashboard

Usage

Wallets

Get all wallets

const wallets = await eversendClient.wallets.getWallets();

Get one wallet

const usdWallet = await eversendClient.wallets.getWallet({ id: "USD" });

Transactions

Get all transactions

const transactions = await eversendClient.transactions.fetchTransactions({ page: 1, limit: 10});

If page and limit are not set, the default of 1 and 10 are used respectively.

Get one transaction

const transaction = await eversendClient.transactions.fetchTransaction({ id: "EVS12345678" });

Exchange

To exchange from one wallet to another, you first have to generate a quotation. This returns a token with a 30s timeout that you can use to make the exchange.

Get exchange quotation

const quotation = await eversendClient.exchanges.getQuotation({
  from: "USD", to: "UGX", amount: 10.0,
});

Exchange currency

const exchange = await eversendClient.exchanges.createExchange({
  quotationToken: "dhhsggajjshhdhdhd",
  transactionRef: "EVS-12345678", // optional field
});

Beneficiaries

Get beneficiaries

const beneficiaries = await eversendClient.beneficiaries.getBeneficiaries({
  page: 1,
  limit: 10
});

If page and limit are not set, the default of 1 and 10 are used respectively.

Get single beneficiary

const beneficiary = await eversendClient.beneficiaries.getBeneficiaries({
  id: 100
});

Create a beneficiary

const beneficiary = await eversendClient.beneficiaries.addBeneficiary({
  firstName: "John",
  lastName: "Okello",
  country: "UG", // Alpha-2 country code
  phoneNumber: "+256712345678", // Should be in international format
  bankAccountName: "John Okello",
  bankAccountNumber: "12345678",
  bankName: "Stanbic Bank",
  bankCode: 1234 // You can get the bank code from payouts.getDeliveryBanks()
});

Note that all bank fields are optional if bank payments will not be required Delete a beneficiary

const beneficiary = await eversendClient.beneficiaries.deleteBeneficiary({
  id: 100
});

Collections

Get collection fees

const collectionFees = await eversendClient.collections.getCollectionFees({
  amount: 1000,
  currency: "KES",
  method: "momo"
});

Get collection OTP

Required when initiating mobile money collections

const collectionOTP = await eversendClient.collections.getCollectionOTP({
  phone: "+256712345678"
});

Initiate Mobile Money collection

eversendClient.collections.initiateMomoCollection({
  phone: "+256712345678",
  amount: 1000,
  country: "UG",
  currency: "UGX",
  otpPin: 123456, // From phone number passed in Get Collection OTP
  otpPinId: "dg524fhsgfde", // From Get Collection OTP
  transactionRef: "EVS-12345678", // Optional transaction ref generated by you
  customer: { name: "John Okello" } // Optional customer object with your metadata
});

Payouts

Get payout quotation

const quotation = await eversendClient.payouts.getQuotation({
  amount: 100,
  amountType: "SOURCE", // amountType can be SOURCE or DESTINATION
  sourceWallet: "USD",
  destinationCountry: "KE",
  destinationCurrency: "KES"
});

amountType refers to whether you want amount to represent sourceWallet (SOURCE) or destinationCurrency (DESTINATION)

Pay existing beneficiary

const payout = eversendClient.payouts.payoutExistingBeneficiary({
  beneficiaryId: 100,
  quotationToken: "token",
  transactionRef: "EVS-12345678" // Optional transaction ref generated by you
});

Pay new beneficiary

const payout = eversendClient.payouts.payoutNewBeneficiary({
  firstName: "John",
  lastName: "Okello",
  country: "UG", // Alpha-2 country code
  phoneNumber: "+256712345678", // Should be in international format
  bankAccountName: "John Okello",
  bankAccountNumber: "12345678",
  bankName: "Stanbic Bank",
  bankCode: 1234, // You can get the bank code from payouts.getDeliveryBanks()
  quotationToken: "token",
  transactionRef: "EVS-12345678" // Optional transaction ref generated by you
});

Get delivery countries

const countries = await eversendClient.payouts.getDeliveryCountries()

Get delivery banks

const banks = await eversendClient.payouts.getDeliveryBanks({
  country: "UG"
});

Cards

Create a card user

const createUser = await eversendClient.card.createCardUser({
  firstName: "John",
  lastName: "Okello",
  email: "[email protected]",
  phoneNumber: "+256712345678", // Should be in international format but optional
});

Note that phone number field is optional

Get card users

const cardUsers = await eversendClient.card.getCardUsers({
   page: 1,
   limit: 10
});

If page and limit are not set, the default of 1 and 10 are used respectively.

Create a card

const card = await eversendClient.card.createCard({
  title: "Netflix payment" // Reason for creating the card, which you can use to identify why you created the card
  color: "blue" // could be blue, black, purple, yellow, orange
  amount: 1000, // Amount to be added to card
  currency: "USD", //The currency which the card creation amount will be deducted from. Use USD
  brand: "visa", // could be visa, mastercard
});

Get all cards

const cards = await eversendClient.card.getAllCards({
   page: 1, // optional
   limit: 10, // optional
   status, // optional
   query, // optional
   from, // optional
   to, // optional
});

If page and limit are not set, the default of 1 and 10 are used respectively.

Get single card details

const card = await eversendClient.card.getSingleCardDetails({
  cardId
});

Get single card transactions

const singleCardTransactions = await eversendClient.card.fetchSingleCardTransaction({
  cardId,
  status, // optional
  query, // optional
  from,  // optional
  to, // optional
  type // optional
  page: 1, // optional
  limit: 10, // optional
});

Get all card transactions

const cardTransactions = await eversendClient.card.fetchAllCardsTransaction({
  status, // optional
  query, // optional
  from,  // optional
  to, // optional
  type // optional
  page: 1, // optional
  limit: 10, // optional
});

Fund a card

const fundCard = await eversendClient.card.fundCard({
  amount, cardId, currency
});

Withdraw from a card

const withDrawCard = await eversendClient.card.cardWithdrawal({
  amount, cardId, currency
});

Freeze a card

const freezeCard = await eversendClient.card.freezeCard({
  cardId
});

Unfreeze a card

const unfreezeCard = await eversendClient.card.unfreezeCard({
  cardId
});

Delete a card

const deleteCard = await eversendClient.card.deleteCard({
  cardId
});

Get card analytics

const cardAnalytics = await eversendClient.card.getCardsAnalytics({
  from,  // optional
  to, // optional
});

Contribution Guidelines

Contributions are welcome and encouraged. Learn more about our contribution guidelines here

License

MIT © Eversend