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

@cowrywise/embed-node

v1.0.4

Published

The Embed Node library provides an easy access to the Embed Investment API by Cowrywise. Embed is an investment-as-a-service API that allows you to integrate investment features in your products and offer financial services to your customers at scale. Wit

Downloads

14

Readme

Embed Node Library

The Embed Node library provides an easy access to the Embed Investment API by Cowrywise. Embed is an investment-as-a-service API that allows you to integrate investment features in your products and offer financial services to your customers at scale. With Embed, developers can create investment accounts for their customers and expose them to a wide variety of investment products!

Documentation

See the Embed API docs.

Prerequisites

  1. Node v6+, 8+ recommended.
  2. NPM

Installation

Use npm:

npm i @cowrywise/embed-node

Usage

To get started, signup for developer credentials on app.cowrywise.com. Once you signup, you can retrieve you client_id and client_secret keys from the developer dashboard. Set your credentials in environment variables.

You need the following before getting to use this library:

  1. Client ID
  2. Client Secret

Getting Started

This library is extremely modular, meaning you can create more than one instance

const Client = require('@cowrywise/embed-node')
const api = new Client({ client_id: '****', client_secret: '****' })

api.wallets.getWallets()
  .then((result) => { /* do something with result */ })
  .catch((err) => { /* retry or show error */})

API

All methods return a <Promise>, hence you can use .then or await. All calls are done by Axios.

Methods

AUTHENTICATION

// Refresh the api_token being used to make all requests
await api.refreshToken();

Accounts

// Create investment account
await api.accounts.createAccount({
    first_name: 'John', 
    last_name: 'Doe', 
    email: '[email protected]'});

// Get all investment accounts
await api.accounts.getAccount();

// Get a specific account by account_id
await api.accounts.getSingleAccount('ACCOUNT_ID');

// Get the portfolio owned by an investment account
await api.accounts.getPortfolio('ACCOUNT_ID');

// Update the address details for an investment account
await api.accounts.updateAddress('ACCOUNT_ID', {
    street: 'Broadway', 
    lga: 'Eti-Osa', 
    area_code: '231', 
    city: 'Lekki', 
    state: 'Lagos', 
    country: 'NG'});

// Update the next-of-kin for an investment account
await api.accounts.updateNextOfKin('ACCOUNT_ID', {
    first_name: 'Jane',
    last_name: 'Obi',
    email: '[email protected]',
    gender: 'M',
    relationship: 'Friend',
    date_of_birth: '1990-10-10',
    phone_number: '+2347000000000'});

// Update the profile of an investment account
await api.accounts.updateProfile('ACCOUNT_ID', {
    first_name: 'Rahman',
    last_name: 'Taiwo',
    email: '[email protected]',
    gender: 'M',
    phone_number: '+2348000000000',
    date_of_birth: '1989-10-10'});

// Update the identity of an investment account
await api.accounts.updateIdentity('ACCOUNT_ID', {
    identity_type: 'bvn',
    identity_value: '0123456789'});

// Add a bank account
await api.accounts.addBank('ACCOUNT_ID', {
    bank_code: '058',
    account_number: '0149541957'});

WALLETS

// Create a wallet
await api.wallets.createWallet({
    account_id: 'ACCOUNT_ID',
    currency_code: 'NGN'});

// Get Wallet information
await api.wallets.getWallets();

// Transfer from Wallet
await api.wallets.transferFromWallet('60919da39e644ef8a4e2ceeabbc97130', {
  product_code: 'PRCDE1203073566',
  amount: '2000'});

SAVINGS

// Create Savings
await api.savings.createSavings({
    account_id: 'ACCOUNT_ID',
    currency_code: 'NGN',
    days: '30',
    interest_enabled: '1'});

// Get Savings
await api.savings.getSavings();

// Get Savings Rates
await api.savings.getSavingsRates('10');

// Withdraw From Savings
await api.savings.withdrawFromSavings('SAVINGS_ID', '20000');

ASSETS

// Get Assets
await api.assets.getAssets();

// Get assets of a specific type
await api.assets.getAssets('mutual-fund');

// Get indexes
await api.assets.getIndexes();

// Get assets of a particular index
await api.assets.getIndexesAsset('INDEX_ID');

Investments

// Get all investments performed by the user
await api.investments.getInvestments();

// Create Investment of a speific type
await api.investments.getInvestments('tbills');

// Create Investment
await api.investments.createInvestment({
    account_id: 'ACCOUNT_ID',
    asset_code: 'AST-TBILL-1741042763'});

// Liquidate Investment
await api.investments.liquidateInvestment({
    index: 'INDEX_ID',
    units: '2'});

TRADE

// List all stocks
await api.trade.getStocks();

PRICES

// Fetch price history
await api.prices.getPriceHistory({
    asset_id: 'ASSET_ID',
    from_date: '2020-01-10',
    to_date: '2021-05-29'});

TRANSACTIONS

// Get all transactions
await api.transactions.getTransactions('10');

TRANSFERS

// Get all transfers
await api.transfers.getTransfers();

// Get all deposits
await api.transfers.getDeposits();

// Get all withdrawals
await api.transfers.getWithdrawals();

Check the API reference document for more examples.

Methods

Kindly check out all methods as well as their request and response structure on the API documentation

Contributions

Before submitting a pull request, kindly ensure:

  • [ ] Necessary tests for the code changes requested are added
  • [ ] There are clear commit messages