Sign InGet Started

Documentation

Everything you need to integrate PayXor into your Web3 application

Getting Started

PayXor provides a simple way to accept on-chain payments in your Web3 application. Follow these steps to get started:

1. Create an Account

Sign up for a PayXor account and create your first application. You'll receive an App ID and API keys.

Sign Up Now

2. Install the SDK

npm install @payxor/sdk

Or use yarn, pnpm, or your preferred package manager.

3. Initialize the Client

import { PayXorClient } from '@payxor/sdk';

// Initialize client (chain selection is configured during app creation)
const client = new PayXorClient({
  apiUrl: 'https://api.payxor.xyz', // Optional
});

4. Generate a Quote

Create a quote on your backend using EIP-712 signing, then send it to your frontend.

// Frontend - Get quote from backend
// Product details (amount, mode, duration) are set by admin and fetched automatically
const { quote, sigBackend } = await client.getQuote({
  appId: '0x...', // App ID as hex string
  productId: '0x...', // Product ID as hex string
  chainId: 8453, // Base
  payer: '0x...', // User's wallet address
});

5. Process Payment

On the frontend, use the signed quote to initiate the payment.

// Frontend
const txHash = await client.pay(quote, sigBackend, account, 8453); // chainId: 8453 (Base)
console.log('Payment successful:', txHash);

Authentication

All API requests require authentication using your API key. Include it in the Authorization header:

Authorization: Bearer your-api-key

Your API key can be found in your dashboard after creating an application. Keep it secure and never expose it in client-side code.

Payment Modes

PayXor supports four payment modes, each designed for different use cases:

Session

Time-limited access to your application. Perfect for subscriptions or temporary premium features.

mode: 0, duration: 3600

Feature

One-time payment to unlock a specific feature permanently. Great for premium upgrades.

mode: 1

Receipt

Verifiable proof of purchase for digital goods. Each payment generates a unique receipt on-chain.

mode: 2

Pass

Membership passes for exclusive access. Issue passes that grant ongoing privileges.

mode: 3

API Reference

Create Quote

POST /api/quote

Generate a payment quote for a product.

{
  "appId": "0x...", // App ID as hex string
  "productId": "0x...", // Product ID as hex string
  "chainId": 8453, // Chain ID
  "payer": "0x..." // Payer wallet address
}
// Note: amount, mode, and duration are fetched from the product definition

Confirm Transaction

POST /api/confirm-tx

Confirm an on-chain payment transaction.

{
  "txHash": "0x...",
  "quote": { ... }
}

Get Products

GET /api/admin/products?appId=string

Retrieve all products for an application.

SDK Integration

The PayXor SDK provides a simple interface for integrating payments into your application.

TypeScript/JavaScript

import { PayXorClient, PaymentMode } from '@payxor/sdk';

const client = new PayXorClient({
  apiUrl: process.env.PAYXOR_API_URL || 'https://api.payxor.xyz',
});

// Get quote (chainId is specified per request)
// Product details (amount, mode, duration) are automatically fetched from the product definition
const { quote, sigBackend } = await client.getQuote({
  appId: '0x...', // App ID as hex string
  productId: '0x...', // Product ID as hex string
  chainId: 8453, // Base
  payer: '0x...', // User's wallet address
});

// Process payment (chainId specified per call)
const txHash = await client.pay(quote, sigBackend, account, 8453);

React Hook Example

import { usePayXor } from '@payxor/sdk/react';

function PaymentButton({ productId }) {
  const { pay, loading } = usePayXor();
  
  const handlePay = async () => {
    try {
      const txHash = await pay({ productId });
      console.log('Payment successful:', txHash);
    } catch (error) {
      console.error('Payment failed:', error);
    }
  };
  
  return (
    <button onClick={handlePay} disabled={loading}>
      {loading ? 'Processing...' : 'Pay Now'}
    </button>
  );
}

Examples

Check out our example applications to see PayXor in action:

Basic Payment Flow

Simple example showing how to create a quote and process a payment.

View Example →

Session-Based Access

Example demonstrating time-limited session payments.

View Example →

Feature Unlock

Example showing how to unlock premium features with one-time payments.

View Example →

Digital Marketplace

Complete example of a marketplace using receipt-based payments.

View Example →

Need Help?

Can't find what you're looking for? Our support team is here to help.