API Documentation

Integrate crypto payments into your application with our simple REST API

Response Time
< 100ms
Security
TLS 1.3
Currencies
20+
Endpoints
8

Quick Navigation

BASE URL

https://crypto.coinxpay.in

YOUR API KEY

pk_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4

Get your API key from the settings page

Authentication

All API requests require authentication using your API key. Include it in the request headers:

HEADER
X-API-Key: pk_your_api_key_here

Security Note

Never expose your API key in client-side code. Always make API calls from your backend server. For production, use environment variables to store your API key.

Endpoints

POST/v1/invoices

Create a new payment invoice

Request Body

amountnumber (required)
currencystring (required)
orderIdstring (optional)
descriptionstring (optional)
customerEmailstring (optional)
customerNamestring (optional)
successUrlstring (optional)
cancelUrlstring (optional)
webhookUrlstring (optional)
expiresInnumber (optional, default: 60)
GET/v1/invoices?id={id}

Get invoice details by ID

Query Parameters

idstring (required) - Invoice ID
GET/v1/invoices

List invoices with filters

Query Parameters

pagenumber (optional, default: 1)
limitnumber (optional, default: 10)
statusstring (optional) - PENDING, PAID, EXPIRED
currencystring (optional)
fromDatestring (optional) - ISO date
toDatestring (optional) - ISO date

Webhooks

Configure webhooks to receive real-time notifications about invoice events. Set your webhook URL in the dashboard to start receiving events.

invoice.createdTriggered when a new invoice is created
invoice.paidTriggered when an invoice is fully paid
invoice.expiredTriggered when an invoice expires
invoice.partialTriggered when a partial payment is received
deposit.confirmedTriggered when a deposit reaches required confirmations

Webhook Payload Example

{
  "event": "invoice.paid",
  "data": {
    "id": "INV_abc123",
    "amount": 0.0234,
    "currency": "BTC",
    "status": "PAID",
    "paidAmount": 0.0234,
    "confirmations": 12,
    "paidAt": "2024-01-15T10:30:00Z"
  }
}

Code Examples

// Create invoice with JavaScript
const createInvoice = async () => {
  try {
    const response = await fetch(, { credentials: 'include' }'https://crypto.coinxpay.in/v1/invoices', {
      method: 'POST',
      headers: {
        'X-API-Key': 'pk_your_api_key_here',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        amount: 0.0234,
        currency: 'BTC',
        orderId: 'ORDER-123',
        customerEmail: 'customer@example.com',
        successUrl: 'https://yoursite.com/success'
      })
    });

    const { data } = await response.json();
    
    // Redirect to invoice page
    window.location.href = data.invoiceUrl;
    
    // Or display QR code
    document.getElementById('qr-code').src = data.qrCode;
    console.log('Invoice created:', data.id);
    
  } catch (error) {
    console.error('Error:', error);
  }
};

Error Handling

400Bad Request - Invalid parameters
401Unauthorized - Missing or invalid API key
403Forbidden - Insufficient permissions
404Not Found - Resource not found
422Unprocessable Entity - Validation error
429Too Many Requests - Rate limit exceeded
500Internal Server Error

Error Response Format

{
  "error": "Invalid parameters",
  "details": {
    "amount": "Amount must be a positive number"
  }
}

Need Help?

Our support team is ready to assist you with any questions about the API integration.