MIPL Payment Gateway is a REST API that lets you accept UPI payments on your website or app. Customer money goes directly to your bank account — MIPL Payment Gateway only provides the payment page, verification and notification technology.
application/json (or form-data).499.00.Asia/Kolkata) using the YYYY-MM-DD HH:MM:SS format.create_order API.payment_url from the response. It shows a QR code, UPI ID and UPI app buttons.payment.success event to your webhook_url. Complete the order / credit the wallet here.redirect_url after seeing "Payment Successful".API Key and API Secret from Dashboard → API Keys.Send these two headers with every API request:
| Header | Value |
|---|---|
X-Api-Key | Your public API key, e.g. mipl_live_… |
X-Api-Secret | Your secret key, e.g. sk_… |
Creates a new payment order and returns a payment link for the customer.
| Parameter | Type | Description |
|---|---|---|
amount required | number | Amount in rupees, from 1 to 100,000. Example: 499 or 499.50 |
order_id required | string | Unique order ID from your system (A-Z, a-z, 0-9, _, -; max 80). Each order_id can be used only once. |
customer_name optional | string | Customer name |
customer_mobile optional | string | 10-digit mobile |
customer_email optional | string | Customer email |
note optional | string | Order description (max 255) |
redirect_url optional | url | The customer is sent here after payment. If omitted, the default from Settings is used. |
webhook_url optional | url | The webhook for this order is sent here. If omitted, the default from Settings is used. |
curl -X POST "https://pay.moldable.in/api/v1/create_order.php" \
-H "Content-Type: application/json" \
-H "X-Api-Key: mipl_live_xxxxxxxxxxxx" \
-H "X-Api-Secret: YOUR_API_SECRET" \
-d '{
"amount": 499,
"order_id": "INV1001",
"customer_name": "Rahul Kumar",
"customer_mobile": "9876543210",
"note": "Wallet top-up",
"redirect_url": "https://yoursite.com/payment-return.php",
"webhook_url": "https://yoursite.com/mipl-webhook.php"
}'
<?php
$payload = [
'amount' => 499,
'order_id' => 'INV1001',
'customer_name' => 'Rahul Kumar',
'customer_mobile' => '9876543210',
'redirect_url' => 'https://yoursite.com/payment-return.php',
'webhook_url' => 'https://yoursite.com/mipl-webhook.php',
];
$ch = curl_init('https://pay.moldable.in/api/v1/create_order.php');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'X-Api-Key: mipl_live_xxxxxxxxxxxx',
'X-Api-Secret: YOUR_API_SECRET',
],
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if ($res['status']) {
header('Location: ' . $res['data']['payment_url']); // send the customer to the payment page
exit;
}
echo $res['error']['message'];
const res = await fetch('https://pay.moldable.in/api/v1/create_order.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Api-Key': 'mipl_live_xxxxxxxxxxxx',
'X-Api-Secret': process.env.MIPL_SECRET,
},
body: JSON.stringify({ amount: 499, order_id: 'INV1001', redirect_url: 'https://yoursite.com/return' }),
});
const json = await res.json();
if (json.status) res.redirect(json.data.payment_url); // Express example
import requests
r = requests.post(
"https://pay.moldable.in/api/v1/create_order.php",
json={"amount": 499, "order_id": "INV1001", "redirect_url": "https://yoursite.com/return"},
headers={"X-Api-Key": "mipl_live_xxxxxxxxxxxx", "X-Api-Secret": "YOUR_API_SECRET"},
timeout=20,
)
data = r.json()
if data["status"]:
payment_url = data["data"]["payment_url"]
{
"status": true,
"message": "Order created",
"data": {
"payment_id": "MPG261120A1B2C3D4E5",
"order_id": "INV1001",
"amount": 499,
"pay_amount": 499.07,
"currency": "INR",
"status": "pending",
"payment_url": "https://pay.moldable.in/pay/?id=MPG261120A1B2C3D4E5",
"upi_id": "yourshop@okaxis",
"upi_intent": "upi://pay?pa=yourshop%40okaxis&pn=Your%20Shop&am=499.07&cu=INR&tn=Pay%20MPG261120A1B2C3D4E5",
"qr_string": "upi://pay?...same as upi_intent...",
"expires_at": "2026-11-20 16:45:00"
}
}
| Field | Description |
|---|---|
payment_id | MIPL Payment Gateway unique payment reference |
pay_amount | The exact amount the customer must pay (with unique paise). Why? |
payment_url | Hosted payment page — redirect the customer here (recommended) |
upi_intent / qr_string | If you want to build your own payment UI, use this string to generate a QR or a "Pay with UPI" button |
expires_at | The payment page stays active until this time (10 minutes) |
Hosted payment page (payment_url) shows the customer:
As soon as the payment succeeds, the page shows "Payment Successful" and redirects to your redirect_url within 3 seconds, with these query params:
https://yoursite.com/payment-return.php?order_id=INV1001&payment_id=MPG261120A1B2C3D4E5&status=success
status=success in the redirect URL. Anyone can type that URL. Credit wallets only from the webhook, or after verifying with the Order status API.When a payment succeeds or fails, MIPL Payment Gateway sends a POST request to your webhook URL.
| Header | Description |
|---|---|
Content-Type | application/json |
X-MIPL-Event | payment.success | payment.failed | test |
X-MIPL-Signature | HMAC-SHA256 (hex) of the raw request body, using your API Secret |
{
"event": "payment.success",
"data": {
"payment_id": "MPG261120A1B2C3D4E5",
"order_id": "INV1001",
"amount": 499,
"pay_amount": 499.07,
"status": "success",
"utr": "432198765012",
"paid_via": "auto",
"customer": { "name": "Rahul Kumar", "mobile": "9876543210", "email": null },
"note": "Wallet top-up",
"created_at": "2026-11-20 16:35:00",
"paid_at": "2026-11-20 16:36:12"
}
}
paid_via: auto (Listener App / automatic UTR match) or manual (approved by the merchant in the dashboard).
<?php
// mipl-webhook.php
$secret = 'YOUR_API_SECRET';
$raw = file_get_contents('php://input');
$sig = $_SERVER['HTTP_X_MIPL_SIGNATURE'] ?? '';
if (!hash_equals(hash_hmac('sha256', $raw, $secret), $sig)) {
http_response_code(401);
exit('invalid signature');
}
$event = json_decode($raw, true);
if ($event['event'] === 'payment.success') {
$p = $event['data'];
// IDEMPOTENT update: only mark pending orders as paid
$st = $pdo->prepare("UPDATE wallet_topups SET status='paid', utr=? WHERE order_id=? AND status='pending' AND amount=?");
$st->execute([$p['utr'], $p['order_id'], $p['amount']]);
if ($st->rowCount() === 1) {
// credit the user's wallet here
}
}
http_response_code(200);
echo 'OK';
const crypto = require('crypto');
// Express: raw body required — app.use('/mipl-webhook', express.raw({ type: 'application/json' }))
app.post('/mipl-webhook', (req, res) => {
const expected = crypto.createHmac('sha256', process.env.MIPL_SECRET).update(req.body).digest('hex');
const sig = req.get('X-MIPL-Signature') || '';
if (sig.length !== expected.length || !crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected))) {
return res.status(401).send('invalid signature');
}
const event = JSON.parse(req.body.toString());
if (event.event === 'payment.success') { /* credit wallet (idempotent) */ }
res.send('OK');
});
import hmac, hashlib, json
from flask import request, abort
@app.post("/mipl-webhook")
def mipl_webhook():
raw = request.get_data()
expected = hmac.new(SECRET.encode(), raw, hashlib.sha256).hexdigest()
if not hmac.compare_digest(expected, request.headers.get("X-MIPL-Signature", "")):
abort(401)
event = json.loads(raw)
if event["event"] == "payment.success":
pass # credit wallet (idempotent)
return "OK"
Check the current status of any order. Use it on your redirect page or for double verification if a webhook is missed.
| Parameter | Description |
|---|---|
order_id | Your order ID |
payment_id | Or the MIPL Payment Gateway payment ID (one of the two is required) |
curl "https://pay.moldable.in/api/v1/order_status.php?order_id=INV1001" \
-H "X-Api-Key: mipl_live_xxxxxxxxxxxx" \
-H "X-Api-Secret: YOUR_API_SECRET"
{
"status": true,
"data": {
"payment_id": "MPG261120A1B2C3D4E5",
"order_id": "INV1001",
"amount": 499,
"pay_amount": 499.07,
"status": "success",
"utr": "432198765012",
"paid_via": "auto",
"customer": { "name": "Rahul Kumar", "mobile": "9876543210", "email": null },
"note": "Wallet top-up",
"created_at": "2026-11-20 16:35:00",
"paid_at": "2026-11-20 16:36:12"
}
}
| Status | Meaning | Final? |
|---|---|---|
pending | Order created, customer has not paid yet | No |
pending_verify | Customer submitted a UTR, awaiting merchant verification | No |
success | Payment confirmed — complete the order | Yes |
expired | Time ran out without payment. (A late payment within 60 min can still auto-match → success) | Mostly |
failed | Merchant rejected the UTR | Yes |
Errors return status: false with an HTTP error code:
{ "status": false, "error": { "code": "validation_error", "message": "amount must be between 1 and 100000" } }
| HTTP | code | When |
|---|---|---|
| 400 | bad_request | Merchant UPI ID not set / bad request |
| 401 | unauthorized | API key / secret wrong or missing |
| 402 | insufficient_balance | Insufficient fee wallet balance — recharge from the dashboard |
| 403 | forbidden | Merchant account blocked |
| 403 | kyc_limit | KYC pending and the order/daily limit was exceeded |
| 404 | not_found | Order not found |
| 405 | method_not_allowed | Wrong HTTP method (create_order is POST only) |
| 409 | duplicate_order | order_id already used |
| 422 | validation_error | Invalid / missing parameter |
| 429 | too_many_pending | Too many pending orders for the same amount — try again shortly |
| 500 | server_error | Server issue — please retry |
Money goes straight to your bank, so the bank SMS contains only the amount and UTR, not the order ID. To tell pending orders apart, MIPL Payment Gateway adds 1–99 unique paise to each amount, e.g. ₹499 → ₹499.07.
amount (your original) and pay_amount (what the customer paid).amount to the wallet. The extra paise are a tiny round-off for the customer.The complete "Add Money" flow for a recharge / BBPS-portal style website:
-- In your database
CREATE TABLE wallet_topups (
id INT AUTO_INCREMENT PRIMARY KEY,
order_id VARCHAR(80) UNIQUE,
user_id INT,
amount DECIMAL(12,2),
status ENUM('pending','paid','failed') DEFAULT 'pending',
utr VARCHAR(30) NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
<?php
// add-money.php
require 'MiplPay.php';
$pg = new MiplPay('mipl_live_xxxxxxxxxxxx', 'YOUR_API_SECRET', 'https://pay.moldable.in');
$orderId = 'WAL' . $userId . 'T' . time();
$pdo->prepare("INSERT INTO wallet_topups (order_id, user_id, amount) VALUES (?,?,?)")
->execute([$orderId, $userId, $amount]);
$order = $pg->createOrder([
'amount' => $amount,
'order_id' => $orderId,
'redirect_url' => 'https://yoursite.com/payment-return.php',
'webhook_url' => 'https://yoursite.com/mipl-webhook.php',
]);
header('Location: ' . $order['payment_url']);
Then credit the wallet in your webhook handler, and show the status on payment-return.php using $pg->orderStatus(['order_id' => $_GET['order_id']]).
The official Listener App uses this API. To build your own custom listener (e.g. Tasker / MacroDroid / your own app):
| Parameter | Description |
|---|---|
device_key required | From Dashboard → Listener App (or the X-Device-Key header) |
action | ping (every 1 minute, for online status) or payment (default) |
message | Full text of the bank SMS / UPI notification — the server extracts the amount and UTR |
amount, utr | Optional — if your app parses them itself |
sender | Optional — SMS sender ID / app package (e.g. VM-SBIINB) |
curl -X POST "https://pay.moldable.in/api/v1/listener.php" \
-d "device_key=dev_xxxxxxxx" \
-d "sender=VM-SBIUPI" \
--data-urlencode "message=Rs.499.07 credited to a/c XX1234 by UPI Ref No 432198765012"
# Response
{ "status": true, "matched": true, "payment_id": "MPG261120A1B2C3D4E5", "message": "Payment matched", "amount": 499.07, "utr": "432198765012" }
A single-file SDK — no Composer dependencies.
⬇ MiplPay.php (SDK) checkout.php webhook.php payment-return.php
<?php
require 'MiplPay.php';
$pg = new MiplPay('mipl_live_xxxxxxxxxxxx', 'YOUR_API_SECRET', 'https://pay.moldable.in');
// Order
$order = $pg->createOrder(['amount' => 499, 'order_id' => 'INV1001']);
header('Location: ' . $order['payment_url']);
// Status
$pg->isPaid('INV1001', 499); // true / false
$pg->orderStatus(['order_id' => 'INV1001']);
// Webhook
$event = $pg->verifyWebhook(file_get_contents('php://input'), $_SERVER['HTTP_X_MIPL_SIGNATURE'] ?? '');
if ($event === null) { http_response_code(401); exit; }
/?wc-api=mipl_upi). The order moves to "Processing" as soon as payment succeeds.Until KYC is approved: max ₹2,000 per order and ₹10,000 per day. Exceeding a limit makes create_order return 403 kyc_limit. Upload your PAN, address and a document in Dashboard → KYC.
Download the APK from Dashboard → Listener App. The app checks for new versions automatically and shows an update prompt.
amount against the amount in your DB.WHERE status='pending').A platform fee of 0.3% (min ₹0.25, max ₹15) is deducted from your prepaid fee wallet on every successful payment. Customers are never charged extra, and there is no fee on failed/expired orders. If the wallet balance is too low, create_order returns 402 insufficient_balance.
Support: +91 8811054210 • support@moldable.in