SDK for 0xPay Merchant API which allows merchants to accept and manage payments on various blockchain networks and fiat assets via integration options.
To start using 0xPay SDK you need to register your personal account and then create merchant at 0xPay to obtain your merchant id and private key and provide it to SDK.
// NPM
npm install @0xpay/sdk
// Yarn
yarn add @0xpay/sdk
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)
import { XPay } from '@0xpay/sdk'
import express from 'express'
// Create XPay instance
const xpay = new XPay(...)
express().post('/ipn', express.raw(), (req, res) => {
const validationError = xpay.validateWebhookRequest({ ...req, ...req.headers })
if (validationError) throw new Error(validationError.description)
// processing your ipn...
res.send('OK')
})