Official PHP Integration Documentation & API Reference
SZ Secure is a unified, white-label payment gateway designed for merchants who need a simple, reliable, and scalable payment integration solution.
All gateway routing, load balancing, and failover mechanisms are handled internally by our infrastructure. Merchants never interact with or see any third-party payment providers directly.
You will receive the following credentials from your SZ Secure dashboard after account activation:
API_KEY : Your unique merchant API key API_SECRET : Your secret key for signing requests
POST https://szsecure.pro/api/payment_create.php
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key |
string | ✅ Yes | Your merchant API key |
merchant_order_id |
string | ✅ Yes | Unique order ID (must be unique per transaction) |
amount |
string | ✅ Yes | Payment amount in INR (must be string, not number) |
notify_url |
string | ✅ Yes | Callback URL for payment notifications |
sign |
string | ✅ Yes | Request signature (MD5 hash) |
amount parameter MUST be sent as a string,
not as a numeric value. Example: "100" not 100
All API requests must be signed using MD5 hash. The signature ensures request integrity and authenticates your API calls.
<?php
// Step 1: Build parameters array
$params = [
'api_key' => 'YOUR_API_KEY',
'merchant_order_id' => 'ORDER_12345',
'amount' => "100", // MUST be string
'notify_url' => 'https://yourdomain.com/callback'
];
// Step 2: Sort parameters alphabetically
ksort($params);
// Step 3: Build signing string
$raw = '';
foreach ($params as $k => $v) {
$raw .= $k . '=' . $v . '&';
}
$raw .= 'key=' . API_SECRET;
// Step 4: Generate MD5 signature
$sign = md5($raw);
// Step 5: Add signature to request
$params['sign'] = $sign;
?>
api_key=7ea136602ca20ba029ae532044362a4d&amount=100&merchant_order_id=TEST_001¬ify_url=https://example.com/callback&key=20fb775c8ecd1a18399107bdbd96fb84
On successful payment creation, you will receive the following JSON response:
{
"status": 1,
"order_sn": "ORD6969ee8f33173",
"pay_url": "https://payment.gateway.com/pay?token=abc123",
"gateway": "szsecure"
}
| Field | Type | Description |
|---|---|---|
status |
integer | 1 = Success, 0 = Failure |
order_sn |
string | Gateway's internal order ID |
pay_url |
string | Payment page URL (redirect user here) |
gateway |
string | Gateway identifier |
<?php
$response = json_decode($apiResponse, true);
if ($response['status'] === 1 && !empty($response['pay_url'])) {
// Redirect user to payment page
header('Location: ' . $response['pay_url']);
exit;
} else {
// Handle error
$error = $response['message'] ?? 'Unknown error';
echo "Payment creation failed: " . $error;
}
?>
Once a payment is completed, SZ Secure will send a server-to-server POST request
to your notify_url with payment details.
{
"order_sn": "ORD6969ee8f33173",
"merchant_order_id": "UPI202601160753516945",
"amount": 200,
"status": "SUCCESS",
"gateway": "szsecure",
"gateway_order_id": "ORD6969ee8f33173",
"time": 1768550081,
"sign": "90027733869FE750CB06A3CB8A0E4435"
}
<?php
// Read callback data
$rawInput = file_get_contents('php://input');
$data = json_decode($rawInput, true);
// Verify signature
$expectedSign = strtoupper(md5(
$data['order_sn'] .
$data['amount'] .
$data['status'] .
API_SECRET
));
if ($expectedSign !== strtoupper($data['sign'])) {
http_response_code(403);
exit('INVALID SIGN');
}
// Signature verified - process payment
if ($data['status'] === 'SUCCESS') {
// Update order status in database
// Credit user wallet
// Send confirmation email
}
// Always return OK to acknowledge receipt
exit('OK');
?>
SUCCESS - Payment completed successfullyFAILED - Payment failedCANCELLED - Payment cancelled by userTest the SZ Secure API with your credentials in real-time:
If you encounter any issues during integration: