Authentication
To secure your API requests, all endpoints require authentication using API key and secret in the headers.
You can obtain your API credentials from the Binance Pay Merchant Dashboard.
Required Headers
Header | Description |
---|---|
X-API-Key |
Your merchant API key |
X-API-Secret |
Your merchant API secret |
Never share your API Secret with anyone or expose it in client-side code.
URLhttps://www.darkmange.us
Create Invoice
Generate a payment invoice for your customers to complete a transaction.
POST /api/create_invoice.php
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
amount |
number | Required | Payment amount |
callback_url |
string | Required | URL to receive payment notification |
success_url |
string | Required | URL to redirect after successful payment |
cancel_url |
string | Required | URL to redirect if payment is cancelled |
Example Request
{
"amount": 100.00,
"callback_url": "https://your-website.com/callback",
"success_url": "https://your-website.com/success",
"cancel_url": "https://your-website.com/cancel"
}
curl -X POST "https://$url/api/create_invoice.php" \
-H "X-API-Key: your_api_key" \
-H "X-API-Secret: your_api_secret" \
-H "Content-Type: application/json" \
-d '{
"amount": 100.00,
"callback_url": "https://your-website.com/callback",
"success_url": "https://your-website.com/success",
"cancel_url": "https://your-website.com/cancel"
}'
Response
Response
200 OK
{
"success": true,
"payment_id": "PAY_abc123def456_1234567890",
"payment_url": "https://example.com/payment_page.php?id=PAY_abc123def456_1234567890",
"amount": 100.00
}
Verify Payment
Check the status of a payment using its ID.
POST /api/check_status.php
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
payment_id |
string | Required | Payment ID to verify |
Example Response
Response
200 OK
{
"success": true,
"payment": {
"payment_id": "121c73de9b34cb330840dd3ad6d3b599",
"amount": "5.00",
"status": "completed",
"created_at": "2025-03-30 08:22:30",
"updated_at": "2025-03-30 08:23:04"
}
}
Payment Callback
After a payment is processed, we'll send a POST request to your callback URL with payment details.
Your server should respond with a 200 OK status code to acknowledge receipt of the callback.
Callback Parameters
Parameter | Type | Description |
---|---|---|
payment_id |
string | Unique payment identifier |
order_id |
string | Order number |
amount |
number | Payment amount |
status |
string | Payment status (completed) |
timestamp |
number | Unix timestamp |
Processing Callback Example
// Receive data that comes POST
$callback_data = $_POST;
$payment_id = $callback_data['payment_id'];
$order_id = $callback_data['order_id'];
$amount = $callback_data['amount'];
if($callback_data['status'] == 'completed'){
//example insert after sucsses
$sql = "INSERT INTO payments (payment_id, order_id, amount) VALUES ('$payment_id', '$order_id', '$amount')";
if (mysqli_query($conn, $sql)) {
echo "Coupon added successfully!";
} else {
$message = "Error: " . mysqli_error($conn);
}
}
$select = mysqli_query($conn,"SELECT * FROM payments WHERE payment_id = '$payment_id'");
$row = mysqli_num_rows($select);
if($row > 0){
echo "Payment Alredy";
}
Important: Always verify callbacks by checking the payment status with the Verify Payment endpoint to prevent fraud.
Verify Payment Arabs
Required Headers
Header | Description |
---|---|
app-token |
Your App Token In App Token Page |
Check the status of a payment using its Sender Number.
POST /api/verify_transaction.php
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
sender |
string | Required | Sender Number to verify |
amount |
Doubel | Required | Amount to verify |
Example Request
Request
200 OK
{
"sender": "0100000000",
"amount": "10.00"
}
Example Response
Response
200 OK
{
"success": true,
"message": "Transaction verified successfully",
"data": {
"trans_id": 449152295533,
"amount": "17.00",
"sender": "01000000000",
"provider": "0",
"state": "completed",
"time": "2025-04-17 18:40:29"
}
}