Accept Crypto Payments
Learn how to integrate DarkPay to accept cryptocurrency payments in your application.
Quick Start
Get started with DarkPay in just a few lines of code:
npm install @darkbit/darkpay
import { DarkPay } from '@darkbit/darkpay';
const darkpay = new DarkPay({
apiKey: 'your-api-key',
environment: 'sandbox' // or 'production'
});
// Create a payment
const payment = await darkpay.payments.create({
amount: 100, // $1.00 in cents
currency: 'USD',
acceptedCryptos: ['BTC', 'ETH', 'XMR'],
redirectUrl: 'https://yoursite.com/success'
});
API Reference
Create Payment
POST /v1/payments
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
amount | integer | Yes | Payment amount in smallest currency unit |
currency | string | Yes | Three-letter ISO currency code |
acceptedCryptos | array | No | List of accepted cryptocurrencies |
Webhooks
Set up webhooks to receive real-time notifications about payment status changes:
// Webhook payload example
{
"id": "pay_1234567890",
"status": "completed",
"amount": 100,
"currency": "USD",
"crypto_amount": "0.00234",
"crypto_currency": "BTC",
"created_at": "2024-01-15T10:30:00Z"
}