Integrate payment gateway with our simple REST API
All API requests require an API key. Include it in the request headers:
X-API-Key: YOUR_API_KEY_HERE
Get your API key from Account Settings → API Keys
POST/api/create_payment.php
Create a new payment link and QR code.
| Parameter | Type | Required | Description |
|---|---|---|---|
| customer_id | string | Required | Unique customer identifier |
| customer_name | string | Optional | Customer name |
| amount | float | Required | Amount in INR (min: ₹10, max: ₹10,000) |
| product_name | string | Optional | Product/service name |
curl -X POST https://darkpay.co/api/create_payment.php \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"customer_id": "CUST_001",
"customer_name": "John Doe",
"amount": 500,
"product_name": "Premium Service"
}'
{
"success": true,
"order_id": "ORDABC123XYZ",
"payment_link": "https://darkpay.co/payment/pay.php?order=ORDABC123XYZ",
"qr_url": "https://quickchart.io/qr?text=...",
"qr_amount": 500.37,
"display_amount": 500,
"upi_id": "merchant@okhdfcbank",
"expires_at": "15-12-2024 04:00:00 PM",
"expires_in_minutes": 30
}
POST/api/verify_payment.php
Verify payment using UTR number.
| Parameter | Type | Required | Description |
|---|---|---|---|
| order_id | string | Required | Order ID from create payment response |
| utr | string | Required | 12-16 digit UTR number |
curl -X POST https://darkpay.co/api/verify_payment.php \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"order_id": "ORDABC123XYZ",
"utr": "123456789012"
}'
{
"success": true,
"message": "✅ Payment verified successfully!",
"payment_id": "PAY12345678",
"order_id": "ORDABC123XYZ",
"amount": 500,
"qr_amount": 500.37,
"utr": "123456789012"
}
GET/api/check_status.php?order_id={order_id}
Check payment status of an order.
curl "https://darkpay.co/api/check_status.php?order_id=ORDABC123XYZ" \
-H "X-API-Key: YOUR_API_KEY"
{
"success": true,
"order_id": "ORDABC123XYZ",
"status": "completed",
"amount": 500,
"qr_amount": 500.37,
"customer_name": "John Doe",
"created_at": "2024-12-15 15:30:00",
"utr": "123456789012"
}
When payment is successful, we send a POST request to your webhook URL.
{
"event": "payment_success",
"order_id": "ORDABC123XYZ",
"payment_id": "PAY12345678",
"customer_id": "CUST_001",
"customer_name": "John Doe",
"amount": 500,
"qr_amount": 500.37,
"utr": "123456789012",
"product_name": "Premium Service",
"verified_at": "15-12-2024 03:35:00 PM"
}
Your webhook endpoint should return HTTP 200 status code.
| HTTP Status | Description |
|---|---|
| 200 | Success (check "success" field) |
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Invalid API key |
| 404 | Not Found |
| 500 | Internal Server Error |