REST API v1 • BDT Exclusive

Merchant Integration & API Docs

Integrate automated bKash & Nagad payment verification into your online shop in less than 15 minutes.

API Base Endpoint
https://pay.managekori.com

All API requests must target this URL over HTTP/HTTPS.

Active Merchant Key ID
key_live_demo123456

Send as X-NP-Key header. Generated in API Keys.

Webhook Signing Secret
your_business_secret_here

Used to verify X-NP-Signature. Located in Settings (matches your Business UUID).

POST /api/v1/payments
Initiate Hosted Checkout Session

Call this endpoint from your backend whenever a customer is ready to checkout. NeoPay creates a unique payment session, locks the price in BDT (৳), and returns a hosted checkout URL where the customer completes the transaction.

Required HTTP Headers

Content-Type: application/json
Accept: application/json
X-NP-Key: key_live_demo123456
Authorization: Bearer <YOUR_API_SECRET_KEY>

Request Body Parameters

Field Type Required Description
order_id string Required Your website's unique order identifier (e.g. ORD-98214).
amount float Required Payable amount in BDT (৳). Must be positive (e.g. 500.00).
provider string Required Payment provider: bkash or nagad.
callback_url url Required Your webhook endpoint. Receives asynchronous payment completion notices.
return_url url Required Customer redirect URL upon payment verification.
cancel_url url Optional Customer redirect destination if they click cancel on checkout.
expiry_minutes integer Optional Session lifespan in minutes (bounded by your merchant subscription plan).

Example Implementation (PHP cURL)

<?php
$payload = [
    'order_id'       => 'ORD-98214',
    'amount'         => 750.00,
    'provider'       => 'bkash', // or 'nagad'
    'callback_url'   => 'https://myshop.com/payment/webhook',
    'return_url'     => 'https://myshop.com/payment/success?order=ORD-98214',
    'cancel_url'     => 'https://myshop.com/cart',
    'expiry_minutes' => 30,
];

$ch = curl_init('https://pay.managekori.com/api/v1/payments');
curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => json_encode($payload),
    CURLOPT_HTTPHEADER     => [
        'Content-Type: application/json',
        'Accept: application/json',
        'X-NP-Key: key_live_demo123456',
        'Authorization: Bearer YOUR_API_SECRET_KEY',
    ],
    CURLOPT_RETURNTRANSFER => true,
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$data = json_decode($response, true);

if ($httpCode === 201 && $data['success']) {
    $checkoutUrl = $data['data']['checkout_url'];
    // Redirect customer browser to hosted checkout:
    header('Location: ' . $checkoutUrl);
    exit;
} else {
    echo "Error creating payment: " . ($data['error']['message'] ?? 'Unknown error');
}

Sample Success Response (HTTP 201 Created)

{
  "success": true,
  "message": "Payment session created successfully.",
  "data": {
    "payment_id": "8bbddf3f-3fa7-4b82-9721-c628613b5a73",
    "order_id": "ORD-98214",
    "amount": 750.00,
    "currency": "BDT",
    "provider": "bkash",
    "status": "pending",
    "session_token": "cs_177da7f9a8fab74253dad192aa2c4acd023afff120c2478f",
    "checkout_url": "https://pay.managekori.com/checkout/cs_177da7f9a8fab74253dad192aa2c4acd023afff120c2478f",
    "expires_at": "2026-10-06 14:45:00"
  }
}
GET /api/v1/payments/{payment_id}
Query Payment Status & Match Details

Poll or query the real-time status of any payment session using the payment_id returned during payment creation.

{
  "success": true,
  "data": {
    "payment_id": "8bbddf3f-3fa7-4b82-9721-c628613b5a73",
    "order_id": "ORD-98214",
    "amount": 750.00,
    "currency": "BDT",
    "provider": "bkash",
    "status": "completed",
    "customer_trx_id": "BK9B76XZ12",
    "matched_transaction": {
      "uuid": "4fc2909f-67db-4523-a267-27e1f4092b11",
      "provider": "bkash",
      "trx_id": "BK9B76XZ12",
      "amount": 750.00,
      "sender_number": "01799887766",
      "source": "sms_auto",
      "received_at": "2026-10-06 13:52:10"
    },
    "callback_status": "sent",
    "callback_attempts": 1,
    "expires_at": "2026-10-06 14:15:00",
    "completed_at": "2026-10-06 13:52:12",
    "created_at": "2026-10-06 13:45:00"
  }
}
WEBHOOK X-NP-Signature (HMAC-SHA256)
Secure Webhook Verification Recipe

When a payment completes, NeoPay dispatches an HTTP POST request to your configured callback_url with a cryptographically secure HMAC-SHA256 signature. Always verify this signature before updating order states to prevent tampering and replay attacks.

<?php
// 1. Obtain raw body and headers
\$rawPayload = file_get_contents('php://input');
\$signature  = \$_SERVER['HTTP_X_NP_SIGNATURE'] ?? '';
\$timestamp  = (int) (\$_SERVER['HTTP_X_NP_TIMESTAMP'] ?? 0);
\$event      = \$_SERVER['HTTP_X_NP_EVENT'] ?? '';

// 2. Your Webhook Secret from Dashboard -> Settings
\$secret = 'your_business_secret_here';

// 3. Verify timestamp freshness (prevent replay attacks, 5 min tolerance)
if (abs(time() - \$timestamp) > 300) {
    http_response_code(400);
    exit('Timestamp expired.');
}

// 4. Compute expected HMAC-SHA256 signature
\$expected = hash_hmac('sha256', \$timestamp . '.' . \$rawPayload, \$secret);

// 5. Compare signatures in constant time
if (!hash_equals(\$expected, \$signature)) {
    http_response_code(401);
    exit('Invalid webhook signature.');
}

// 6. Process verified event
\$eventData = json_decode(\$rawPayload, true);
if (\$event === 'payment.completed' || (\$eventData['status'] ?? '') === 'completed') {
    \$orderId = \$eventData['order_id'];
    \$trxId   = \$eventData['trx_id'];
    \$amount  = \$eventData['amount'];

    // Mark order as paid in your database:
    // Order::markPaid(\$orderId, \$trxId, \$amount);
}

// Always respond with HTTP 200 to acknowledge receipt
http_response_code(200);
echo json_encode(['status' => 'acknowledged']);