Home / Documentation / REST API v1.2

Developer API & Dual Checkout Architecture

The modern payment rail engineered specifically for Pakistani commerce. Accept JazzCash USSD Flash Push, Easypaisa App Push, and Raast Dynamic OneQR (EMVCo ISO 20022) with our Dual Integration Architecture: choose between a frictionless Drop-In Modal checkout or a 100% White-Label Direct API running entirely on your own domain.

โ— 99.98% Core Gateway Uptime
โšก < 1.2s Average USSD Push Latency
๐Ÿ”’ TLS 1.3 HMAC-SHA256 Signed Rails
DUAL CHECKOUT Core Capability

Dual Checkout Integration Methods

Flux offers two purpose-built integration paradigms. Select the approach that matches your security model, developer resources, and desired customer conversion flow:

METHOD 2 100% ON YOUR DOMAIN

White-Label Direct API & Headless

Zero redirects. Collect customer mobile numbers natively in your own custom UI and dispatch direct USSD flash prompts, Easypaisa app pushes, or raw Raast OneQR strings.

  • 100% Domain & Brand Control: Customer stays entirely on your store or in your native iOS/Android mobile app.
  • Direct JazzCash USSD Push: Trigger immediate MPIN prompt directly onto customer's handset.
  • Direct Easypaisa App Push: Dispatch push authorization to customer's Easypaisa mobile app.
  • Raw Raast Dynamic OneQR: Render compliant EMVCo ISO 20022 QR code payload natively on your canvas.
Explore Method 2 Docs
Visual Architecture: Dual Checkout Execution Sequence
1. MERCHANT SERVER Your Web Store / App POST /payments/create Amount, OrderID, Signature 2. FLUX CORE ENGINE Dual Routing Switch โ€ข Mode A: Drop-In Modal โ€ข Mode B: Direct Charge API Dispatches USSD / QR 3. PAKISTAN RAILS JazzCash USSD Push Easypaisa App Push Raast OneQR (1Link) Customer MPIN Prompt 4. SETTLED HMAC Hook payment.done Order Fulfilled
Interactive Tool

Drop-In Modal Live Sandbox Simulator

Test customized brand branding, dynamic colors, channel switching, and simulated USSD authorization.

LIVE SDK POSTMESSAGE EVENT STREAM CONNECTED
[flux:ready] Simulator ready. Click "Launch Simulator Modal" to trigger events.
Luxe Apparel Lahore
Order #ORD-8941 โ€ข Encrypted by Flux
Total Payable PKR 3,450.00
Select Payment Channel:
Customer receives an instant MPIN flash prompt on this phone.

Dual Environments & Base URL

Flux maintains separate isolated environments for sandbox development and production traffic. All calls require HTTPS with TLS 1.3 encryption.

Live Production https://gofluxpay.com

Processes live transactions routed to State Bank of Pakistan 1Link and telco switches.

Sandbox Testing https://gofluxpay.com/sandbox

Zero real money deductions. Simulates USSD approvals, declines, timeouts, and QR scans.

Idempotency Guarantees: Pass the Idempotency-Key: <UUID> header on all state-mutating requests (such as /payments/create and /payouts/create). This safely prevents duplicate charges in cases of network dropped packets or automated merchant retries.

Authentication & API Keys

Authenticate your requests by supplying your secret API Key in the HTTP Authorization header using the standard Bearer scheme:

Authorization: Bearer flx_live_9a8b7c6d5e4f3a2b1c0d
Standard HTTP Request Headers
Header Type Status Description
Authorization string Required Bearer secret key generated in Merchant Dashboard > API Keys.
Content-Type string Required Must be set to application/json for all POST requests.
Idempotency-Key string Optional Unique client UUIDv4 to safeguard against double charging on network timeouts.
POST /api/v1/auth/token

OAuth Token Handshake

Generate temporary scoped Bearer tokens for server-to-server automation and high-security payout operations.

Request Parameters
Parameter Status Description
merchant_id string Required Your merchant account identifier (e.g. mrc_live_9a8b7c6d5e).
api_key string Required Your production API secret key from Merchant Portal.
Loading snippet...
Sample Responses
{
  "success": true,
  "access_token": "flx_tok_9a2b8e4f1c7d0b3a5e8f",
  "token_type": "Bearer",
  "expires_in": 86400,
  "scope": "payin payout title_fetch"
}
POST /api/v1/payments/create

Method 1: Create Hosted & Drop-In Checkout Session

Initialize a payment session from your backend. Flux returns a unique checkout_url and secure session token to either launch the Drop-In Modal on your cart or redirect the customer.

Request Parameters
Parameter Status Description
merchant_id string Required Your merchant public MID (e.g. mrc_live_9a8b7c6d5e).
amount decimal Required Order total in PKR (e.g. 2500.00). Min 1.00, Max 1,000,000.00.
order_id string Required Unique alphanumeric invoice or order reference from your system.
customer_name string Optional Customer full name (pre-fills checkout forms).
payer_phone string Optional Customer mobile in 03XXXXXXXXX format for automatic wallet pre-fill.
payer_email string Optional Customer email address for digital payment receipts.
return_url string Optional Browser redirect URL after customer completes payment.
webhook_url string Optional Per-transaction override for instant payment notification webhooks.
Loading snippet...
Sample Responses
{
  "success": true,
  "payment": {
    "payment_id": "pay_9a7bc418",
    "order_id": "ORDER-1001",
    "amount": 2500,
    "status": "pending",
    "checkout_url": "https://gofluxpay.com/checkout.php?payment=pay_9a7bc418&token=a1b2c3d4e5f60718293a4b5c6d7e8f90",
    "token": "a1b2c3d4e5f60718293a4b5c6d7e8f90",
    "expires_at": 1735689600
  }
}
POST /api/public/charge.php

Method 2: JazzCash Mobile USSD Push

Direct headless execution for JazzCash. Sends an immediate USSD Flash PIN Prompt to the customer mobile handset. The customer inputs their 4-digit MPIN directly on their screen to authorize the charge without redirecting.

Request Parameters
Parameter Status Description
payment_id string Required Flux payment identifier returned from session creation (pay_9a7bc418).
token string Required Checkout session verification token.
method string Required Must be set to literal string "jazzcash".
mobile_number string Required Customer JazzCash mobile wallet number in 03XXXXXXXXX format.
Loading snippet...
Sample Responses
{
  "success": true,
  "message": "USSD push prompt dispatched to handset.",
  "payment_id": "pay_9a7bc418",
  "status": "pending_ussd",
  "expires_in_seconds": 90
}
POST /api/public/charge.php

Method 2: Easypaisa In-App Push Authorization

Dispatches an in-app authorization push notification to the customer Easypaisa smartphone app. Customer simply taps Approve or inputs their OTP to complete the transaction.

Request Parameters
Parameter Status Description
payment_id string Required Flux payment ID (pay_9a7bc418).
token string Required Checkout session verification token.
method string Required Must be set to literal string "easypaisa".
mobile_number string Required Customer Easypaisa account phone number (e.g. 03451234567).
Loading snippet...
Sample Responses
{
  "success": true,
  "message": "In-app push notification sent to Easypaisa app.",
  "payment_id": "pay_9a7bc418",
  "status": "pending_app_approval",
  "expires_in_seconds": 120
}
POST /api/public/charge.php

Method 2: Raast Dynamic OneQR (EMVCo ISO 20022)

Returns a compliant EMVCo Raast OneQR string. Render this dynamic QR directly on your native HTML canvas or app screen. Any Pakistani banking app (Meezan, HBL, Alfalah, SadaPay, NayaPay) can scan and instantly settle.

Request Parameters
Parameter Status Description
payment_id string Required Flux payment ID (pay_9a7bc418).
token string Required Checkout session verification token.
method string Required Must be set to literal string "oneqr".
Loading snippet...
Sample Responses
{
  "success": true,
  "payment": {
    "payment_id": "pay_9a7bc418",
    "status": "pending_qr_scan",
    "qr_string": "00020101021228560010A00000072701260010PK.RAAST.01012345678952044814530358654072500.005802PK5916Luxe Store LHR6006Lahore6304A1B2",
    "expires_at": 1735689600
  }
}
GET /api/public/checkout-status.php

Method 2: Direct Headless Status Polling

While the customer enters their MPIN on their handset or scans the Raast QR, poll this lightweight endpoint every 2 seconds from your frontend JavaScript.

Request Parameters
Parameter Status Description
payment string Required Flux payment identifier (pay_9a7bc418).
token string Required Client session token.
Loading snippet...
Sample Responses
{
  "success": true,
  "payment": {
    "payment_id": "pay_9a7bc418",
    "order_id": "ORDER-1001",
    "amount": 2500,
    "status": "completed",
    "payment_method": "jazzcash"
  }
}
GET /api/v1/payments/status

Payment Status Verification (Server-to-Server)

Authoritative server-to-server check to verify transaction settlement states using your secret API key.

Request Parameters
Parameter Status Description
payment_id string Required Flux payment ID (pay_9a7bc418).
merchant_id string Required Your merchant account MID.
order_id string Optional Alternative lookup using your internal order ID.
Loading snippet...
Sample Responses
{
  "success": true,
  "payment": {
    "payment_id": "pay_9a7bc418",
    "order_id": "ORDER-1001",
    "amount": 2500,
    "fee": 43.75,
    "net_amount": 2456.25,
    "currency": "PKR",
    "status": "completed",
    "payment_method": "jazzcash",
    "payer_phone": "03001234567",
    "customer_name": "Tariq Khan",
    "settled_at": "2026-11-14T11:42:18Z"
  }
}
GET /api/v1/payouts/banks

Disbursements: Supported Banks & Wallets Catalog

Retrieve all 1Link participant financial institutions and microfinance wallets with their active routing codes (IMD codes) for instant Inter-Bank Funds Transfers (IBFT).

Loading snippet...
Sample Responses
{
  "success": true,
  "count": 36,
  "banks": [
    {
      "code": "MBL",
      "name": "Meezan Bank Limited",
      "type": "bank",
      "active": true
    },
    {
      "code": "HBL",
      "name": "Habib Bank Limited",
      "type": "bank",
      "active": true
    },
    {
      "code": "BAFL",
      "name": "Bank Alfalah Limited",
      "type": "bank",
      "active": true
    },
    {
      "code": "JC",
      "name": "JazzCash Mobile Wallet",
      "type": "wallet",
      "active": true
    },
    {
      "code": "EP",
      "name": "Easypaisa Mobile Wallet",
      "type": "wallet",
      "active": true
    },
    {
      "code": "SADA",
      "name": "SadaPay",
      "type": "emi",
      "active": true
    },
    {
      "code": "NAYA",
      "name": "NayaPay",
      "type": "emi",
      "active": true
    }
  ]
}
POST /api/v1/payouts/title-fetch

Disbursements: Account Title Verification (Title Fetch)

Perform a real-time account title lookup to display the verified beneficiary account title prior to initiating funds transfer, avoiding accidental transfers to wrong account numbers.

Request Parameters
Parameter Status Description
merchant_id string Required Your merchant account MID.
account_number string Required Beneficiary bank account number or IBAN.
bank_code string Required Bank code from catalog (e.g. MBL, HBL, JC, EP).
Loading snippet...
Sample Responses
{
  "success": true,
  "account_title": "MUHAMMAD USMAN KHAN",
  "account_number": "0102030405060708",
  "bank_code": "MBL",
  "bank_name": "Meezan Bank Limited",
  "verified": true
}
POST /api/v1/payouts/create

Disbursements: Execute Instant IBFT Payout

Instantly transfer funds to any Pakistani bank account or mobile wallet via 1Link IBFT. Deductions are settled from your available merchant float balance in real-time.

Request Parameters
Parameter Status Description
merchant_id string Required Your merchant account MID.
amount decimal Required Transfer amount in PKR (e.g. 15000.00).
account_number string Required Beneficiary destination account number or IBAN.
bank_code string Required Institution routing code (e.g. MBL).
beneficiary_name string Required Verified account holder name from Title Fetch step.
narration string Optional Transfer description / invoice reference.
Loading snippet...
Sample Responses
{
  "success": true,
  "payout_id": "payout_981a2c",
  "amount": 15000,
  "fee": 25,
  "status": "processed",
  "rrn": "614210998124",
  "beneficiary_title": "MUHAMMAD USMAN KHAN",
  "transferred_at": "2026-11-14T11:45:00Z"
}
GET /api/v1/payouts/status

Disbursements: Payout Status Inquiry

Query transaction state of an individual disbursement.

Request Parameters
Parameter Status Description
payout_id string Required Flux payout ID (payout_981a2c).
merchant_id string Required Your merchant account identifier.
Loading snippet...
Sample Responses
{
  "success": true,
  "payout": {
    "payout_id": "payout_981a2c",
    "amount": 15000,
    "status": "processed",
    "rrn": "614210998124"
  }
}
GET /api/v1/payouts/balance

Disbursements: Float Balance Inquiry

Check your live available settlement pool balance for outgoing disbursements.

Request Parameters
Parameter Status Description
merchant_id string Required Your merchant identifier.
Loading snippet...
Sample Responses
{
  "success": true,
  "currency": "PKR",
  "available_balance": 485000,
  "pending_balance": 15200,
  "reserved_balance": 50000
}
HMAC-SHA256 POST <merchant_webhook_url>

Signed Webhooks & Real-Time Delivery

Flux pushes instant HTTP POST notifications to your server whenever asynchronous payment, settlement, or payout events occur. Payloads are signed with your secret Webhook Signing Key.

Webhook Event Lifecycle Types
Event Name Trigger Moment Fulfillment Action
payment.completed Customer approved USSD prompt, app push, or paid via Raast QR. Mark order Paid & trigger digital delivery.
payment.failed Payment expired, customer rejected USSD, or insufficient funds. Release held inventory back to store.
payout.processed 1Link IBFT transfer successfully reached destination bank account. Update vendor or user withdrawal ledger.
payout.failed Beneficiary bank rejected transaction (invalid title or offline). Refund amount back to merchant float.
Signature Verification Required: Webhook requests include the X-Flux-Signature header containing an HMAC-SHA256 digest. Always compute and compare the signature using constant-time string comparison before fulfilling orders.
Loading webhook verification snippet...
Sample Webhook Event Payload
{
  "event": "payment.completed",
  "created_at": "2026-11-14T11:42:18Z",
  "data": {
    "payment_id": "pay_9a7bc418",
    "order_id": "ORDER-1001",
    "amount": 2500.00,
    "fee": 43.75,
    "currency": "PKR",
    "payment_method": "jazzcash",
    "payer_phone": "03001234567"
  }
}
REFERENCE Error Specifications

Error Codes & Handling Matrix

Flux returns standard HTTP 4xx and 5xx status codes accompanied by detailed JSON error envelopes to assist in quick diagnosis and user recovery:

HTTP Status Error Code Root Cause Suggested Merchant Recovery
400 Bad Request MISSING_PARAMETER Required field like amount or merchant_id was omitted. Validate JSON request payload prior to dispatching.
401 Unauthorized INVALID_API_KEY Supplied Bearer key is invalid, revoked, or formatted incorrectly. Verify API secret key in Merchant Portal > API Keys.
403 Forbidden KYC_PENDING Merchant account documentation is awaiting compliance review. Submit CNIC and business registration in Merchant Portal.
404 Not Found PAYMENT_NOT_FOUND Supplied payment_id does not exist in this environment. Verify whether transaction occurred in Sandbox or Live.
409 Conflict IDEMPOTENCY_MISMATCH The same Idempotency-Key was reused with different payload parameters. Generate a distinct UUIDv4 for distinct transactions.
422 Unprocessable INSUFFICIENT_FUNDS Customer wallet lacks sufficient balance or exceeded monthly cap. Prompt customer to fund their wallet or switch channel.
429 Rate Limit RATE_LIMIT_EXCEEDED API requests exceeded 300 requests/minute threshold. Implement exponential backoff or request limit upgrade.
500 Server Error GATEWAY_TIMEOUT Upstream telco or 1Link banking switch did not reply in time. Retry with identical Idempotency-Key.
WOOCOMMERCE Turnkey E-Commerce

WordPress & WooCommerce Plugin Integration

Accept JazzCash, Easypaisa, and Raast OneQR on your WooCommerce store in 5 minutes with zero custom PHP programming:

  1. Download Plugin: In your Merchant Portal, go to Integrations > WooCommerce and download flux-pay-woocommerce.zip.
  2. Install in WordPress: Open WP Admin > Plugins > Add New > Upload Plugin and activate Flux Pay.
  3. Configure Credentials: Navigate to WooCommerce > Settings > Payments > Flux Pay and enter your Merchant ID and Production API Key.
  4. Choose Checkout Mode: Toggle between Drop-In Popup Modal (customer pays without leaving your cart) or Hosted Redirect.
SHOPIFY App Bridge

Shopify Custom Gateway Setup

Integrate Flux Pay into your Shopify Pakistan store:

  1. Install Custom Gateway: Under your Shopify admin settings, add Flux as an off-site payment provider.
  2. Link Merchant Account: Enter your Production API key and Webhook URL.
  3. Test Order: Place a PKR 1.00 live checkout to ensure inventory clearance and webhook callbacks function cleanly.