Skip to content

evanfokin/cryptocloud.js

Repository files navigation

Cryptocloud.js

Wrapper for working with cryptocloud.plus API

GitHub Workflow Status npm npm

Installation

Install with npm:

npm install cryptocloud

Install with yarn:

yarn add cryptocloud

Usage

TypeScript

import { CryptoCloud, Currency, StatusInvoice } from 'cryptocloud'

const cryptoCloud = new CryptoCloud('apiKey', 'shopId')

/** Invoice creation */
const invoice = await cryptoCloud.createInvoice({
  amount: 100,
  orderId: 'myOrderId',
  currency: Currency.USD,
  email: 'customer@gmail.com'
})

/** Checking invoice status */
const status = await cryptoCloud.checkInvoiceStatus({ uuid: invoice.invoiceId })
if (status.statusInvoice === StatusInvoice.CREATED) {
  // ...
}

JavaScript

import { CryptoCloud } from 'cryptocloud'

const cryptoCloud = new CryptoCloud('apiKey', 'shopId')

/** Invoice creation */
const invoice = await cryptoCloud.createInvoice({
  amount: 100,
  orderId: 'myOrderId',
  currency: 'USD',
  email: 'customer@gmail.com'
})

/** Checking invoice status */
const status = await cryptoCloud.checkInvoiceStatus({ uuid: invoice.invoiceId })
if (status.statusInvoice === 'created') {
  // ...
}

Local development

  1. npm ci i
  2. create and fill out .env file based on .env.example
  3. make sure all tests are passed by running npm test