Authentication

All API requests require authentication using API key and secret in the headers:

  • X-API-Key: Your merchant key
  • X-API-Secret: Your merchant secret

Create Invoice

POST /api/create_invoice.php

Request Parameters

Parameter Type Required Description
amount number Yes Payment amount
callback_url string Yes URL to receive payment notification
success_url string Yes URL to redirect after successful payment

Example Request

{
    "amount": 100.00,
    "callback_url": "https://your-website.com/callback",
    "success_url": "https://your-website.com/success"
}

Example Response

{
    "success": true,
    "payment_id": "PAY_abc123def456_1234567890",
    "payment_url": "https://example.com/payment_page.php?id=PAY_abc123def456_1234567890",
    "amount": 100.00
}

Verify Payment

POST /api/check_status.php

Request Parameters

Parameter Type Required Description
payment_id string Yes Payment ID to verify

Example Request

{
    "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 successful payment, your callback URL will receive a POST request with the following 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

Payment Verification

To verify the callback authenticity:

// Receive data that comes POST
$paylod = file_get_contents("php://input");

// JSON decoding
$callback_data = json_decode($paylod, true);

$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"; 
}