Getting started

Node.js 0xPay integration package

To authorize your requests and use SDK you have to obtain private key.

0xPay SDK allows to integrate and start work with Merchant Public API in several moves.

Getting started

Prerequisites

To start using 0xPay SDK you need merchant id and private key. So you must register an account and create a merchant to obtain API credentials.

Note: If you want to receive and process webhook notifications, you will need to setup your merchant.

Installation

// NPM
npm i @0xpay/sdk
// Yarn
yarn add @0xpay/sdk

Create instance

import { XPay } from '@0xpay/sdk'

const MERCHANT_ID = 'your-merchant-id'
const MERCHANT_PRIVATE_KEY = 'your-merchant-private-key'

// Create XPay instance
const xpay = new XPay(MERCHANT_ID, MERCHANT_PRIVATE_KEY)

Get available crypto assets

import { XPay } from '@0xpay/sdk'

// Create XPay instance
const xpay = new XPay(...)

// Use 0xPay API 
xpay.getAvailableCryptoAssets().then((assets) => console.log(assets))

Create receiving crypto address

import { XPay } from '@0xpay/sdk'

// Create XPay instance
const xpay = new XPay(...)

// Use 0xPay API
xpay.createReceiveAddress({ blockchain: 'BITCOIN', meta: 'user 1' })
    .then((address) => console.log(address))

Last updated