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

webitspay-node-sdk

v0.0.1

Published

### How to use

Downloads

3

Readme

Webitspay NodeJS SDK

How to use

npm install webitspay-node-sdk

const Webitspay = require('webitspay-node-sdk');

const webitspay = new webitspay(WEBITSPAY_PUBLIC_KEY, WEBITSPAY_SECRET_KEY);

Use TEST API keys for testing, and LIVE API keys for production

Webitspay Methods exposed by the sdk

1. Payment

  • Initialize Payment
  • Confirm Payment

2. Payout

  • Crypto Payout
  • Bank Payout ~ coming soon

3. Payment Links

  • Create payment links
  • Get all payment links
  • Get a single payment link
  • Update a payment Link

4. Misc

  • Get all accepted coins

Payment

Initialize Payment

This describes to allow your customers to initiate a crypto payment transfer.

const Webitspay = require('webitspay-node-sdk');

const webitspay = new webitspay(WEBITSPAY_PUBLIC_KEY, WEBITSPAY_SECRET_KEY);

const payment_tx = async () => {
  try {
    const transaction_payload = {
      reference: 'YOUR_REFERENCE', // Replace with a reference you generated
      customer_name: 'John Oseni',
      customer_email: '[email protected]',
      coin: 'BUSD', // BUSD, DAI, USDC or USDT
      currency: 'USD', // NGN, AED, GBP, EUR
      amount: 100,
      accept_partial_payment: true, // By default it's false
      metadata: { 
        type: "Wallet fund"
      } // Metadata is an optional param
    };

    const response = await webits.Payment.initializePayment(transaction_payload);

    console.log(response);
  } catch (error) {
    console.log(error);
  }
};

Confirm Payment

This describes to allow you confirm your customers transaction after payment has been made.

const Webitspay = require('webitspay-node-sdk');

const webitspay = new Webitspay(WEBITSPAY_PUBLIC_KEY, WEBITSPAY_SECRET_KEY);

const confirm_tx = async () => {
  try {
    const payload = {
      identifier:
        'address generated or the reference generated by you from initializing payment',
    };

    const response = await webits.Payment.confirmPayment(payload);

    console.log(response);
  } catch (error) {
    console.log(error);
  }
};

Transfer

Crypto Payout

This describes to allow you withdraw the crypto in their webitspay balance to an external address

const Webitspay = require('webitspay-node-sdk');

const webitspay = new Webitspay(WEBITSPAY_PUBLIC_KEY, WEBITSPAY_SECRET_KEY);

const crypto_payout_tx = async () => {
  const transaction_payload = {
    amount: 1,
    recipient: '0x0B4d358D349809037003F96A3593ff9015E89efA', // address must be a bep20 address
    coin: 'BUSD',
    blockchain: 'Binance Smart Chain',
  };
  try {
    const response = await webits.Payout.transferCrypto(transaction_payload);
    console.log(response.error);
  } catch (e) {
    console.log(e);
  }
};

Payment Links

Create a payment link

This describes to allow you create a Payment link programatically

const Webitspay = require('webitspay-node-sdk');

const webitspay = new Webitspay(WEBITSPAY_PUBLIC_KEY, WEBITSPAY_SECRET_KEY);

const create_paymentlink_tx = async () => {
  const transaction_payload = {
    title: 'John Testing',
    description: 'Testing this sdk',
    logo:
      'https://assets.audiomack.com/fireboydml/bbbd8710eff038d4f603cc39ec94a6a6c2c5b6f4100b28d62557d10d87246f27.jpeg?width=340&height=340&max=true',
    currency: 'USD',
    type: 'standard',
    amount: 150 // Optional
  };
  try {
    const response = await webits.PaymentLinks.createPaymentLink(
      transaction_payload
    );
    console.log(response);
  } catch (e) {
    console.log(e);
  }
};

Update a payment link

This describes disabling or enabling a payment link by updating it

const Webitspay = require('webitspay-node-sdk');

const webitspay = new Webitspay(WEBITSPAY_PUBLIC_KEY, WEBITSPAY_SECRET_KEY);

const transaction_payload = {
  identifier: '7f2vrd8n',
  status: 'inactive', // status should either be active or inactive
};

const update_paymentLink = async () => {
  try {
    const response = await webits.PaymentLinks.updatePaymentLink(
      transaction_payload
    );
    console.log(response);
  } catch (e) {
    console.log(e);
  }
};

Get all payment links

This describes to allow you get all Payment links created

const Webitspay = require('webitspay-node-sdk');

const webitspay = new Webitspay(WEBITSPAY_PUBLIC_KEY, WEBITSPAY_SECRET_KEY);

const get_all_paymentlinks = async () => {
  try {
    const response = await webits.PaymentLinks.getAllPaymentLinks();
    console.log(response);
  } catch (e) {
    console.log(e);
  }
};

Get a single payment link

This describes to allow you get a Payment link by it's identifier

const Webitspay = require('webitspay-node-sdk');

const webitspay = new Webitspay(WEBITSPAY_PUBLIC_KEY, WEBITSPAY_SECRET_KEY);

const identifier = '7f2vrd8n';

const get_paymentlink = async () => {
  try {
    const response = await webits.PaymentLinks.getPaymentLink(identifier);
    console.log(response);
  } catch (e) {
    console.log(e);
  }
};

Misc

Get Accepted Coins

This gets the list of accepted cryptocurrencies on Webitspay

const Webitspay = require('webitspay-node-sdk');

const webitspay = new Webitspay(WEBITSPAY_PUBLIC_KEY, WEBITSPAY_SECRET_KEY);

const get_accepted_coins = async () => {
  try {
    const response = await webits.Misc.getAcceptedCoins();
    console.log(response);
  } catch (error) {
    console.log(error);
  }
};