Unified, secure payment orchestration for 30+ gateways
The MultiGateway Hub API is a secure, RESTful payment orchestration platform offering unified transaction handling, refunds, webhooks, fraud prevention, and gateway abstraction across 30+ providers.
# Navigate to your project directory cd /path/to/your/website # Run installation script php api/tools/install.php
This will:
php api/tools/key_manager.php
tbl_usersMy Application** or specific IPs⚠ Save your API key securely. It is shown only once.
curl https://yourdomain.com/api/v1/health
curl -X POST https://yourdomain.com/api/v1/transactions/create \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"amount": 10,
"currency": "USD",
"user_id": 1,
"description": "Test transaction"
}'
<?php
$apiKey = 'mgw_your_api_key';
$apiUrl = 'https://yourdomain.com/api/v1';
$ch = curl_init($apiUrl . '/transactions/create');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode([
'amount' => 99.99,
'currency' => 'USD',
'user_id' => 123,
'description' => 'Premium subscription'
]),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey
]
]);
$response = curl_exec($ch);
$result = json_decode($response, true);
if ($result['success']) {
header('Location: ' . $result['data']['payment_url']);
}
?>
<?php
$ch = curl_init($apiUrl . '/transactions/verify');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode([
'transaction_id' => 'txn_xxx'
]),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey
]
]);
$response = curl_exec($ch);
?>
<?php
$payload = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_SIGNATURE'] ?? '';
$secret = 'your_webhook_secret';
if (!hash_equals(hash_hmac('sha256', $payload, $secret), $signature)) {
http_response_code(401);
exit('Invalid signature');
}
$data = json_decode($payload, true);
?>
$transaction = createAPITransaction([ 'amount' => $cartTotal, 'currency' => 'USD', 'user_id' => $userId, 'custom_data' => ['order_id' => $orderId] ]);
$transaction = createAPITransaction([ 'amount' => 29.99, 'currency' => 'USD', 'description' => 'Monthly Pro Plan' ]);
$transaction = createAPITransaction([
'amount' => 123.00,
'taxes' => [
['label' => 'GST', 'rate' => 18, 'amount' => 18]
],
'shipping_fee' => 5
]);
mgw_api/logs/api.log