REST API V2

Developer Integration Reference

Accept automated payments via EasyPaisa and JazzCash with simple HTTP endpoints.

1. Authentication

All requests are authenticated using your api_key. You can obtain your keys from the Merchant Dashboard.

Base URL: https://npfast.site/api/

POST

/api/create_payment.php

Create a new checkout session. Returns a session token and hosted checkout_url.

PHP cURL Example:
<?php
$payload = [
    'api_key'      => 'pk_live_your_api_key',
    'amount'       => 2500.00,
    'order_id'     => 'ORDER_' . time(),
    'customer_name'  => 'John Doe',
    'customer_mobile'=> '03001234567'
];

$ch = curl_init('https://npfast.site/api/create_payment.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);

if ($response['status'] === 'success') {
    // Redirect customer to checkout URL:
    header('Location: ' . $response['checkout_url']);
    exit;
}
?>
Sample JSON Response:
{
  "status": "success",
  "order_id": "PAY_98F012DA",
  "amount": 2500.00,
  "currency": "PKR",
  "checkout_url": "https://npfast.site/checkout.php?token=tok_4a89c...",
  "expires_in_minutes": 5
}

3. Webhook Notification

Once the customer completes the payment, our matching engine verifies the transaction and delivers an instant HTTP POST callback to your configured webhook_url.

Webhook JSON Payload:
{
  "event": "payment.paid",
  "order_id": "PAY_98F012DA",
  "merchant_order_ref": "ORDER_1792240192",
  "amount": 2500.00,
  "currency": "PKR",
  "trx_id": "402089985762",
  "sender_mobile": "03331234567",
  "status": "paid",
  "timestamp": "2026-10-17 18:45:00"
}
GET

/api/check_status.php?order_id=...

Query the real-time status of any payment order directly from your server or client poller.

GET https://npfast.site/api/check_status.php?order_id=PAY_98F012DA&api_key=pk_live_your_key