npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

x-pay-sdk-official

v0.1.3

Published

Official Node.js SDK for X-Pay cryptocurrency payment gateway

Readme

X-Pay Node.js SDK

Official Node.js SDK for the X-Pay cryptocurrency payment gateway.

Installation

npm install x-pay-sdk-official
# or
yarn add x-pay-sdk-official

Features

  • Create cryptocurrency payout orders (merchant sends crypto to user)
  • Create cryptocurrency collection orders (merchant receives crypto from user)
  • Check order status
  • Get supported cryptocurrencies and chains
  • Verify and parse webhook notifications
  • TypeScript support with full type definitions

Quick Start

import { XPay } from 'xpay-sdk';

// Initialize the SDK with your API credentials
const xpay = new XPay({
  apiKey: 'your-api-token',
  apiSecret: 'your-api-secret',
  baseUrl: 'https://api.x-pay.fun', // Optional, defaults to production API
});

// Create a payout order (merchant sends crypto to user)
async function createPayout() {
  try {
    const payout = await xpay.createPayout({
      amount: 100,
      symbol: 'USDT',
      chain: 'TRON',
      orderId: `order-${Date.now()}`, // Optional order ID
      uid: 'user123', // Required user ID
      receiveAddress: 'TXmVthgn6yT1kANGJHTHcbEGEKYDLLGJGp' // User's wallet address
    });
    
    console.log('Payout created successfully:');
    console.log('- Code:', payout.code);
    console.log('- Message:', payout.msg);
    console.log('- Order ID:', payout.data?.orderId);
    
    return payout;
  } catch (error) {
    console.error('Error creating payout:', error);
  }
}

API Reference

Configuration

const xpay = new XPay({
  apiKey: 'your-api-token',
  apiSecret: 'your-api-secret',
  baseUrl: 'https://api.x-pay.fun', // Optional, defaults to production API
  timeout: 30000, // Optional, request timeout in milliseconds
});

Payout Orders

Create a payout order (merchant sends crypto to user)

const payout = await xpay.createPayout({
  amount: 100,
  symbol: 'USDT',
  chain: 'TRON',
  orderId: 'order-123', // Optional order ID
  uid: 'user123', // Required user ID
  receiveAddress: 'TXmVthgn6yT1kANGJHTHcbEGEKYDLLGJGp' // User's wallet address
});

// Response structure
{
  code: 200,
  msg: 'Success',
  data: {
    orderId: 'order-123',
    status: 'PENDING',
    amount: '100.00000000',
    symbol: 'USDT',
    chain: 'TRON',
    uid: 'user123',
    receiveAddress: 'TXmVthgn6yT1kANGJHTHcbEGEKYDLLGJGp'
  }
}

Collection Orders

Create a collection order (merchant receives crypto from user)

const collection = await xpay.createCollection({
  amount: 50,
  symbol: 'USDT',
  chain: 'TRON',
  orderId: 'order-123', // Optional order ID
  uid: 'user123', // Required user ID
});

// Response structure
{
  code: 200,
  msg: 'Success',
  data: {
    orderId: 'order-123',
    address: 'TW8ArYLg5PuwYugmYM8QSux5oXxfUbXA8c',
    amount: '50.00000000',
    symbol: 'USDT',
    chain: 'TRON',
    uid: 'user123',
    expiredTime: 1753380643035
  }
}

Order Status

Get order status

const orderDetails = await xpay.getOrderStatus('order-123');

// Response structure
{
  code: 200,
  msg: 'Success',
  data: {
    orderId: 'order-123',
    orderType: 'PAYOUT',
    status: 'SUCCESS',
    reason: '',
    transaction: {
      chain: 'TRON',
      symbol: 'USDT',
      blockNum: 73971843,
      txid: '938d4d20f049bfe45f429f1c3cb62de7c57d3f7505ae691b79aa9a024f23ef87',
      contractAddress: 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
      from: 'TGyjjt1esfqJWrPncpygq3QA43epY46V8D',
      to: 'TXmVthgn6yT1kANGJHTHcbEGEKYDLLGJGp',
      amount: '100.00000000',
      timestamp: 1752573867000,
      txGas: 27.35985,
      confirmedNum: 196573,
      status: 'SUCCESS'
    }
  }
}

Supported Symbols

Get supported symbols

// Get all supported symbols
const allSymbols = await xpay.getSupportedSymbols();

// Response structure
{
  code: 200,
  msg: 'Success',
  data: [
    {
      symbol: 'USDT',
      chain: 'TRON',
      decimals: 6,
      contract: 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
      minAmount: 1,
      maxAmount: 100000
    },
    // Other supported symbols...
  ]
}

Webhooks

Verify and parse webhook

// Express.js example
app.post('/webhook', express.json(), (req, res) => {
  const webhookData = req.body;
  const signature = webhookData.sign;
  const timestamp = webhookData.timestamp.toString();
  const body = JSON.stringify(webhookData);
  
  const event = xpay.parseWebhook(body, signature, timestamp);
  
  if (!event) {
    return res.status(400).send('Invalid webhook signature or timestamp expired');
  }
  
  // Process the webhook event
  switch (event.notifyType) {
    case 'ORDER_SUCCESS':
      // Handle order success notification
      const orderData = event.data;
      console.log(`Order ${orderData.orderId} completed successfully!`);
      break;
    case 'COLLECT_SUCCESS':
      // Handle collection success notification
      const collectData = event.data;
      console.log(`Collection completed successfully! Amount: ${collectData.collectAmount}`);
      break;
    // Handle other notification types...
  }
  
  res.status(200).send('Webhook received');
});

Error Handling

The SDK throws detailed errors that include status codes and error messages from the API:

try {
  const payout = await xpay.createPayout({
    // ...payout details
  });
} catch (error) {
  console.error(`Error: ${error.message}`);
  console.error(`Status: ${error.status}`);
  console.error(`Code: ${error.code}`);
  console.error(`Data: ${JSON.stringify(error.data)}`);
}

TypeScript Support

This SDK includes comprehensive TypeScript definitions for all methods and data structures.

License

MIT