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

payercoins-node-sdk

v0.0.8

Published

Official Payercoins nodejs sdk

Downloads

8

Readme

Logo

Payercoins v1 NodeJS SDK

How to use

npm install payercoins-node-sdk

const Payercoins = require('payercoins-node-sdk');

const payercoins = new Payercoins(PAYERCOINS_PUBLIC_KEY, PAYERCOINS_SECRET_KEY);

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

NOTE: There are both live and test section and both of them have live and test(public and secret key) respectively.

Payercoins Method exposed by the sdk

  1. Accept Payment
  • Initialize Payment
  • Verify Payment
  1. Fetch Payment
  • Fetch Invoice details
  • Fetch Payment details by Reference ID
  1. Cancel Payment
  • Crypto to crypto (Coming soon)
  • Crypto to fiat (Coming soon)

Accept Crypto Payment

Initialize Payment

This describes how to allow your customers to initiate payments transaction transfer.

const Payercoins = require('payercoins-node-sdk');

const payercoins = new Payercoins(PAYERCOINS_PUBLIC_KEY, PAYERCOINS_SECRET_KEY);

const initiatePayment = async () => {
    try {
        const initiate_payment_payload = {
            currency?: ['ethereum'], //ethereum, bitcoin, usdt-eth. If not provided, the default activated currency type will be used. i.e ['ethereum', 'bitcoin', 'usdt-trx']
            amount: 150,
            payment_type: 'api', //api, donation
            customer_name: 'John Doe', // this is the customer name
            customer_email: '[email protected]', // this is the customer email
            description: 'this is a test payment', // this is the payment description
            redirect_url?: string, // optional
            invoice_id?: string, // optional - unique identifier for your payment and minLength 8, else we will automatically generate one
            callback_url: 'your-preferred-callback-url', //optional. This is the url where the customer will be redirected to after payment is completed.
        }

        const response = await payercoins.Checkout.initiateTransaction(initiate_payment_payload);

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

Fetch Payment

Fetch Invoice Details

This describes how to allow your customers to fetch payments details by invoice_id.

const Payercoins = require('payercoins-node-sdk');

const payercoins = new Payercoins(PAYERCOINS_PUBLIC_KEY, PAYERCOINS_SECRET_KEY);

const fetchDetailsInvoice = async () => {
  try {
    const payload = ''; // invoice_id
    const response = await payercoins.Checkout.getInvoiceDetails(payload);
    console.log(response);
  } catch (error) {
    console.log(error);
  }
};

Fetch Payment Details By Reference

This describes how to allow your customers to fetch payments details by reference.

const Payercoins = require('payercoins-node-sdk');

const payercoins = new Payercoins(PAYERCOINS_PUBLIC_KEY, PAYERCOINS_SECRET_KEY);

const fetchPaymentDetailsByReference = async () => {
  try {
    const url = ''; // url
    const response = await payercoins.Checkout.getPaymentDetailsByReference(url);
    console.log(response);
  } catch (error) {
    console.log(error);
  }
};

Cancel Payment

This describes how to allow your customers to cancel payments.

const Payercoins = require('payercoins-node-sdk');

const payercoins = new Payercoins(PAYERCOINS_PUBLIC_KEY, PAYERCOINS_SECRET_KEY);

const cancelPayment = async () => {
  try {
    const url = ''; // url
    const response = await payercoins.Checkout.cancelPayment(url);
    console.log(response);
  } catch (error) {
    console.log(error);
  }
};

Process Payment

const Payercoins = require('payercoins-node-sdk');

const payercoins = new Payercoins(PAYERCOINS_PUBLIC_KEY, PAYERCOINS_SECRET_KEY);

const processPayment = async () => {
  try {
    const url = ``; // url
    const process_payment_payload = {
      crypto: 'string', // uuid of crypto
    };
    const response = payercoins.Checkout.processPayment(url, process_payment_payload);
    console.log(response);
  } catch (error) {
    console.log(error);
  }
};

Confirm Payment

This describes how to allow you confirm your customers payment transaction transfer after payment is made.

const Payercoins = require('payercoins-node-sdk');

const payercoins = new Payercoins(PAYERCOINS_PUBLIC_KEY, PAYERCOINS_SECRET_KEY);

const confirmPayment = async () => {
  try {
    const confirm_payment_payload = "invoice_id", //id generate when you initiate payment

    const response = await payercoins.Checkout.confirmPayment(confirm_payment_payload);

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