API Documentation

Integrate payment gateway with our simple REST API

v1.0 REST API

Authentication

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

Create Payment

POST/api/create_payment.php

Create a new payment link and QR code.

Request Body
ParameterTypeRequiredDescription
customer_idstringRequiredUnique customer identifier
customer_namestringOptionalCustomer name
amountfloatRequiredAmount in INR (min: ₹10, max: ₹10,000)
product_namestringOptionalProduct/service name
Example Request
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"
  }'
Example Response
{
  "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
}

Verify Payment

POST/api/verify_payment.php

Verify payment using UTR number.

Request Body
ParameterTypeRequiredDescription
order_idstringRequiredOrder ID from create payment response
utrstringRequired12-16 digit UTR number
Example Request
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"
  }'
Example Response
{
  "success": true,
  "message": "✅ Payment verified successfully!",
  "payment_id": "PAY12345678",
  "order_id": "ORDABC123XYZ",
  "amount": 500,
  "qr_amount": 500.37,
  "utr": "123456789012"
}

Check Status

GET/api/check_status.php?order_id={order_id}

Check payment status of an order.

Example Request
curl "https://darkpay.co/api/check_status.php?order_id=ORDABC123XYZ" \
  -H "X-API-Key: YOUR_API_KEY"
Example Response
{
  "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"
}

Webhook

When payment is successful, we send a POST request to your webhook URL.

Webhook Payload
{
  "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.

Error Codes

HTTP StatusDescription
200Success (check "success" field)
400Bad Request - Invalid parameters
401Unauthorized - Invalid API key
404Not Found
500Internal Server Error