Giter Site home page Giter Site logo

payment-crypto's Introduction

Payment Crypto

Introduction

This simple module is based on Crypto Pay API for easy use.

Crypto Pay is a payment system based on Crypto Bot that allows you to accept payments in crypto and transfer coins to users using this module.

Installation

Installation from npm

npm i payment-crypto

Installation from yarn in the future

Setup

Importing

CommonJS. For the use of async functions in the main scope, try this:

const PaymentCrypto = require('payment-crypto');
(async () => {
  // async functions
})();

ES6. Supports the use of async functions in main scope:

import PaymentCrypto from 'payment-crypto';
// async functions

To use ES6, add to package.json:

"type": "module"

Authorization

First, you need to create a new app and get API token. Open @CryptoBot, go to Crypto Pay and tap Create App to get API Token.

const token = '1234:TOKEN'; // replace with your token
const payment = new PaymentCrypto(token);

Authorization in testnet

Getting testnet token is similar to the mainnet. Open @CryptoTestnetBot, go to Crypto Pay and tap Create App to get API Token.

const token = '1234:TOKEN'; // replace with your testnet token
const payment = new PaymentCrypto(token, {
  mode: 'testnet',
});

Example

This is a small ES6 example with which you can easily start using payment-crypto.

import PaymentCrypto from 'payment-crypto';
const token = '1234:TOKEN'; // replace with your testnet token
const payment = new PaymentCrypto(token, {
  mode: 'testnet',
});

const me = await payment.getMe();
console.log(me);

You can find more examples here.

Useful links

payment-crypto's People

Contributors

kiogia avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.