Node.js
Introduction

Introduction

Learn how to cash your first crypto payment using the vxpay Node.js SDK.

Prerequisites

1. Install

Get the vxpay Node.js SDK.

npm install vxpay

2. Accept onchain payment

index.ts
import { VXPAY } from 'vxpay';
 
const vxpay = new VXPAY('YOUR_API_KEY');
 
(async function () {
  const { data, error } = await vxpay.checkout.create({
    environment:'sandbox',
    params: {
      currency: 'USD',
      amount: 3500,
      title: 'Your Product Title',
      description: 'Your Product Description',
      callback_url: 'https://yourdomain.com/payment_success',
    },
  });
 
  if (error) {
    return console.error({ error });
  }
 
  console.log({ data });
})();

3. Try it yourself