Integrate crypto payments into your application with our simple REST API
https://crypto.coinxpay.inAll API requests require authentication using your API key. Include it in the request headers:
X-API-Key: pk_your_api_key_hereNever 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.
/v1/invoicesCreate a new payment invoice
amountnumber (required)currencystring (required)orderIdstring (optional)descriptionstring (optional)customerEmailstring (optional)customerNamestring (optional)successUrlstring (optional)cancelUrlstring (optional)webhookUrlstring (optional)expiresInnumber (optional, default: 60)/v1/invoices?id={id}Get invoice details by ID
idstring (required) - Invoice ID/v1/invoicesList invoices with filters
pagenumber (optional, default: 1)limitnumber (optional, default: 10)statusstring (optional) - PENDING, PAID, EXPIREDcurrencystring (optional)fromDatestring (optional) - ISO datetoDatestring (optional) - ISO dateConfigure 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 createdinvoice.paidTriggered when an invoice is fully paidinvoice.expiredTriggered when an invoice expiresinvoice.partialTriggered when a partial payment is receiveddeposit.confirmedTriggered when a deposit reaches required confirmations{
"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"
}
}// 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": "Invalid parameters",
"details": {
"amount": "Amount must be a positive number"
}
}Our support team is ready to assist you with any questions about the API integration.