Accept payments in Bangladesh with one API call.
RongOps is a single integration for bKash, Nagad, Rocket, Upay, cards and internet
banking. Post an order to one endpoint, send the customer to the returned
payment_url, and get the result back on your own return URL.
Overview
The RongOps Gateway API lets your website or app start a payment and learn its outcome. There are only two URLs you ever need:
| Purpose | Method | URL |
|---|---|---|
| Create a checkout | POST | https://api.rongops.com/payment/checkout |
| Gateway callback (ours, not yours) | ANY | https://api.rongops.com/payment/callback |
The second URL is RongOps's own return endpoint — the gateway sends the
customer back there after payment, we settle the transaction and credit your wallet, and
only then do we forward the customer to your return URL. You do not call it
yourself; you set your own URL in the callback_url parameter.
Everything else in this document is detail on top of those two URLs.
Quick start
Five minutes from zero to a working payment.
-
Get your credentials
Sign in to the merchant dashboard and open Profile → API Credentials to copy your
user_code,store_idandhash_key. -
Whitelist your domain and server IP
Add both the website domain you will send requests from and the hosting IP it calls from — both must be Approved before a payment is accepted. A request from an unapproved domain or IP is rejected.
-
Post an order
Send the customer's details and the amount to
/payment/checkout. You get back apayment_url. -
Send the customer there
Redirect the browser to
payment_url, or let the form post redirect automatically. -
Handle the result
We forward the customer to your
callback_urlwith the final status, and credit your wallet on success.
Never mark an order as paid from a front-end redirect alone — always verify the
status your return URL receives, and reconcile against the transaction list
in your dashboard.
Credentials
| Credential | Where to find it | What it is |
|---|---|---|
user_code |
Dashboard header | Your public merchant code (e.g. MRCUSR398728). Identifies the account. |
store_id |
Profile → API Credentials | A UUID tied to your store. Verified on every request. |
hash_key |
Profile → API Credentials | A secret UUID. Treat it like a password — server-side only. |
store_id and hash_key are both required and are
checked against your account on every request. Knowing your user_code alone is
not enough to start a payment. Never ship hash_key in front-end JavaScript —
keep the request server-side where you can.
Payment lifecycle
-
You create the checkout
POST to
/payment/checkout. We validate your credentials, the origin domain and the hosting IP, compute the charge, and store apendingtransaction. -
Customer pays
They land on the secure gateway page and pick bKash, Nagad, Rocket, Upay, card or internet banking.
-
Gateway calls us back
The gateway returns the customer to
https://api.rongops.com/payment/callback. We verify the result with the gateway, never trusting the browser. -
We settle
On a verified success, the charge is applied and the net amount is credited to your wallet instantly.
-
We forward to you
The customer is redirected to your
callback_urlwith the transaction result appended as query parameters.
Create checkout
https://api.rongops.com/payment/checkout
| Content type | application/x-www-form-urlencoded |
| Auth | store_id + hash_key in the body |
| Response | HTTP 302 redirect to the gateway, or JSON when requested |
| Aliases | /payment/create-payment, /api/create-payment (legacy) |
Choosing the response type
There are two behaviours, and you pick one per request:
- Browser form post — the default. We answer with an HTTP 302 straight to the gateway page, so a plain HTML form is all you need.
- JSON — send
response_type=json, or anAccept: application/jsonheader. Ideal for cURL, mobile apps and SPAs, because you get apayment_urlto use however you like.
Request parameters
| Parameter | Type | Status | Description |
|---|---|---|---|
user_code | String | Required | Your merchant code, e.g. MRCUSR398728. |
store_id | UUID | Required | Store identifier from API Credentials. Verified against your account. |
hash_key | UUID | Required | Secret key from API Credentials. Verified against your account. |
total_amount | Decimal | Required | Order amount in BDT. Must be greater than zero. |
customer_name | String | Required | Paying customer's full name. |
customer_email | String | Required | Customer email address. |
customer_phone | String | Required | Customer mobile number, e.g. 01711223344. |
callback_url | URL | Recommended | Your own return URL. We append the result as query parameters. Alias: webhook_url. |
response_type | String | Optional | Send json to receive a JSON body instead of a 302 redirect. |
callback_url must start with http:// or https://.
A malformed value is discarded rather than rejected, so a typo silently costs you the
redirect back to your site.
Response format
Browser form post
The response is an HTTP 302 with a Location header pointing at the gateway. The browser follows it automatically — you do not need to handle anything.
JSON
With response_type=json or Accept: application/json:
{
"status": true,
"message": "Payment initialized successfully",
"payment_url": "https://pg.eps.com.bd/PG?data=8bbc429d-0d1f-43d5-9efe-233322960ca6",
"order_id": "ORD20260806123456",
"merchant_transaction_id": "TXN20260806123"
}
| Field | Type | Description |
|---|---|---|
status | Boolean | true when the checkout was created, false on rejection. |
message | String | Human-readable result or error reason. Show it while debugging, log it in production. |
payment_url | String | The gateway page to send the customer to. Only present on success. |
order_id | String | Our order reference for this payment. |
merchant_transaction_id | String | Our transaction reference. Store it — it is how you reconcile later. |
Gateway callback
https://api.rongops.com/payment/callback
This is RongOps's endpoint, not yours. The gateway redirects the customer here after payment, exactly as it does for the platform's own checkout. You never call it — we register it with the gateway when your checkout is created.
What happens when it is hit:
- The transaction is looked up from the reference the gateway sends back.
- The result is verified with the gateway — a browser saying "success" is never trusted on its own.
- On success the charge is applied and the net amount is credited to your wallet exactly once.
- The customer is redirected onward to your
callback_urlwith the result attached.
Callbacks can arrive more than once. Settlement is idempotent — a repeated callback will not credit your wallet twice.
Your return URL
After settlement the customer is redirected to the callback_url you supplied, with
these query parameters appended. Existing query parameters already on your URL are preserved.
https://yoursite.com/payment/callback
?status=success
&order_id=ORD20260806123456
&merchant_transaction_id=TXN20260806123
&gateway_transaction_id=260805145449560YU
&payment_method=bKash
&amount=1000.00
&charge_amount=20.00
&net_amount=980.00
| Field | Type | Description |
|---|---|---|
status | String | success, failed or cancelled. |
order_id | String | Our order reference, matching the value from the checkout response. |
merchant_transaction_id | String | Our transaction reference — use this as your primary key for reconciliation. |
gateway_transaction_id | String | Reference issued by the underlying gateway. |
payment_method | String | Channel used, e.g. bKash, Nagad, Rocket, Upay, VISA, Mastercard. |
amount | Decimal | Gross amount the customer paid. |
charge_amount | Decimal | Transaction charge applied to this payment. |
net_amount | Decimal | Amount credited to your wallet. Always amount − charge_amount. |
Treat this redirect as a notification, not proof. The parameters are in the
query string, so a user could craft a URL that looks like a success. Confirm the
merchant_transaction_id against your own records (or the dashboard) before
releasing goods or services.
HTML form
The fastest integration — no server code at all, though the customer details are then visible in the page source.
<form method="POST" action="https://api.rongops.com/payment/checkout">
<input type="hidden" name="user_code" value="MRCUSR398728">
<input type="hidden" name="store_id" value="c3b57dbf-b51a-438d-98c2-166baac10871">
<input type="hidden" name="hash_key" value="9f1c8b2e-...-redacted">
<input type="hidden" name="callback_url" value="https://yoursite.com/payment/callback">
<input type="hidden" name="customer_name" value="Rahim Ahmed">
<input type="hidden" name="customer_email" value="[email protected]">
<input type="hidden" name="customer_phone" value="01711223344">
<label for="amt">Amount (BDT)</label>
<input id="amt" type="number" step="0.01" min="1" name="total_amount" value="1000.00" required>
<button type="submit">Pay with RongOps</button>
</form>
A form post puts hash_key in the HTML. That is acceptable for a demo or a
fully static site where the merchant owns every visitor, but if your checkout is dynamic,
prefer a server-side call so the key never leaves your backend.
It also will not pass the binding check. A browser form post connects from
the customer's IP, which is never your approved hosting IP, so the request is
rejected. Start the payment from your own server instead — a small backend endpoint that
calls /payment/checkout with Origin: https://your-domain.com and
then redirects the customer to the returned payment_url (see the PHP, Node.js
and Python tabs below).
PHP (cURL)
<?php
const RONGOPS_CHECKOUT = 'https://api.rongops.com/payment/checkout';
$payload = [
'user_code' => 'MRCUSR398728',
'store_id' => 'c3b57dbf-b51a-438d-98c2-166baac10871',
'hash_key' => '9f1c8b2e-...-redacted',
'total_amount' => 1000.00,
'customer_name' => 'Rahim Ahmed',
'customer_email' => '[email protected]',
'customer_phone' => '01711223344',
'callback_url' => 'https://yoursite.com/payment/callback',
'response_type' => 'json',
];
$ch = curl_init(RONGOPS_CHECKOUT);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query($payload),
CURLOPT_RETURNTRANSFER => true,
// RONGOPS binds every request to the domain it came from (Origin header) and
// the connecting hosting IP — both must be Approved under My Websites. cURL
// sends no Origin of its own, so declare your registered domain explicitly.
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Origin: https://yoursite.com',
],
CURLOPT_TIMEOUT => 30,
]);
$body = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$result = json_decode((string) $body, true);
if (!empty($result['payment_url'])) {
// Send the customer to the gateway page.
header('Location: ' . $result['payment_url']);
exit;
}
http_response_code(502);
echo 'Could not start payment: ' . ($result['message'] ?? 'unknown error');
Handling the return
<?php
$status = $_GET['status'] ?? 'failed';
$txnRef = $_GET['merchant_transaction_id'] ?? '';
$amount = (float) ($_GET['amount'] ?? 0);
$net = (float) ($_GET['net_amount'] ?? 0);
// The query string is user-controllable, so confirm the transaction against
// your own order table before releasing anything.
$order = find_order_by_transaction($txnRef); // your own lookup
if ($order && $status === 'success' && (float) $order['amount'] === $amount) {
mark_order_paid($order['id'], $net);
header('Location: /thank-you');
} else {
header('Location: /payment-failed');
}
exit;
Node.js
app.post('/pay', async (req, res) => {
const body = new URLSearchParams({
user_code: 'MRCUSR398728',
store_id: 'c3b57dbf-b51a-438d-98c2-166baac10871',
hash_key: process.env.RONGOPS_HASH_KEY,
total_amount: String(req.body.amount),
customer_name: req.body.name,
customer_email: req.body.email,
customer_phone: req.body.phone,
callback_url: 'https://yoursite.com/payment/callback',
response_type: 'json',
});
const upstream = await fetch('https://api.rongops.com/payment/checkout', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json',
// Your registered website domain — verified together with the server IP.
'Origin': 'https://yoursite.com',
},
body,
});
const data = await upstream.json();
if (data.payment_url) {
return res.redirect(302, data.payment_url);
}
return res.status(502).json({ error: data.message || 'Payment init failed' });
});
Keep hash_key in an environment variable, never in source or in client-side bundles.
Python
import os
import requests
from flask import Flask, request, redirect
app = Flask(__name__)
CHECKOUT_URL = "https://api.rongops.com/payment/checkout"
@app.post("/pay")
def pay():
payload = {
"user_code": "MRCUSR398728",
"store_id": "c3b57dbf-b51a-438d-98c2-166baac10871",
"hash_key": os.environ["RONGOPS_HASH_KEY"],
"total_amount": "1000.00",
"customer_name": "Rahim Ahmed",
"customer_email": "[email protected]",
"customer_phone": "01711223344",
"callback_url": "https://yoursite.com/payment/callback",
"response_type": "json",
}
r = requests.post(
CHECKOUT_URL,
data=payload,
# Your registered website domain — verified together with the server IP.
headers={"Accept": "application/json", "Origin": "https://yoursite.com"},
timeout=30,
)
data = r.json()
if data.get("payment_url"):
return redirect(data["payment_url"], code=302)
return {"error": data.get("message", "Payment init failed")}, 502
Security
Credential verification
Every request must carry a matching user_code, store_id and
hash_key. A mismatch is rejected before any transaction is created, and the
response is a plain failure such as:
{ "status": false, "message": "Invalid store_id or hash_key for this merchant account." }
Domain & IP binding
Every request is bound to both the website domain it came from and the hosting IP it connects from. Both must belong to a website you registered under My Websites and that an admin has Approved — matching one of the two is not enough.
The domain is read from the Origin header, falling back to the host of
Referer. A browser always sends Origin on a cross-origin POST; a
server-to-server call must send one explicitly, so include
Origin: https://your-registered-domain.com in your HTTP client.
{ "status": false, "message": "This payment was blocked: your account is not authorized from the IP the request came from (203.0.113.7). Copy this exact IP and add/update it as your Server IP in the RONGOPS merchant panel -> My Websites, then wait for admin approval before initiating payments." }
{ "status": false, "message": "This payment was blocked: your account is not authorized from the domain the request came from (shop.example.com). Copy this exact domain and add/update it in the RONGOPS merchant panel -> My Websites, then wait for admin approval before initiating payments." }
There is no onboarding grace: an account with no approved website on file is blocked from initiating any payment until at least one website — domain and IP — is approved. Only on-box calls (loopback, or the server calling its own IP) skip the check, because that request never leaves the machine.
Recommended practices
- Keep
hash_keyserver-side; rotate it if it ever leaks. - Call over HTTPS only.
- Verify the amount you receive back matches the order you created.
- Never mark an order paid from the redirect alone — reconcile through the API or dashboard.
- Log
merchant_transaction_idfor every attempt so support can trace a payment.
Amounts & charges
Your agreed transaction charge (a percentage, a flat amount, or both, depending on your agreement) is applied to every successful payment. Two arrangements exist, and your account uses exactly one of them:
| Mode | Customer pays | You receive | Wallet credit |
|---|---|---|---|
| Merchant pays (default) | total_amount |
total_amount − charge |
net_amount |
| Customer pays | total_amount + charge |
total_amount |
net_amount |
The invariant holds in both modes:
total_amount = net_amount + charge_amount
In merchant pays mode the gross the customer is charged equals the
total_amount you sent, so the amount shown on the gateway page matches your
order total exactly. In customer pays mode the customer is charged the
charge on top, and your wallet receives the full order amount.
Your settlement mode is controlled by you in the merchant dashboard under
Profile → Transaction Charge. Read the exact figures for any payment from the
amount, charge_amount and net_amount values returned to
your callback URL rather than recomputing them.
Status codes
| HTTP | Meaning | What to do |
|---|---|---|
200 | Success — JSON body contains payment_url. | Redirect the customer. |
302 | Form-post success — redirect to the gateway. | Nothing; the browser follows it. |
400 | Missing or malformed parameters. | Fix the request; do not retry unchanged. |
401 | Invalid store_id / hash_key. | Re-check credentials in the dashboard. |
403 | Origin domain or IP not approved. | Add the origin in the dashboard. |
404 | Unknown route. | Check the URL — it must be /payment/checkout. |
502 | Gateway unreachable or rejected the init. | Log the message and retry with backoff. |
Payment status values
| Value | Meaning |
|---|---|
pending | Checkout created, customer has not finished yet. |
success | Verified and settled; wallet credited. |
failed | Payment attempt failed at the gateway. |
cancelled | Customer abandoned the gateway page. |
Error handling
Failures come back as JSON with status: false and a readable message:
{
"status": false,
"message": "Failed to initialize payment gateway page."
}
Common messages
| Message | Cause | Fix |
|---|---|---|
Invalid store_id or hash_key… |
Credentials do not match the account. | Copy both values again from Profile → API Credentials. |
This payment was blocked: your account is not authorized from the IP… |
The connecting IP is not on your approved list. | Add that exact IP as the Server IP under My Websites and get it approved. |
This payment was blocked: your account is not authorized from the domain… |
The Origin/Referer host is not on your approved list. |
Add that exact domain under My Websites and get it approved. |
This payment was blocked: the request carried no origin domain. |
No Origin or Referer header was sent. |
Send Origin: https://your-domain.com from your HTTP client. |
Could not retrieve Token from EPS Gateway. |
Upstream token request failed. | Retry with backoff; contact support if it persists. |
Failed to initialize payment gateway page. |
Gateway accepted the token but rejected the order. | Check the amount and customer fields; retry. |
Payment gateway is currently under maintenance. |
An operator switched the gateway off. | Show a friendly message and retry later. |
Retry policy
- Retry
502and timeout failures with exponential backoff (1s, 2s, 4s…). - Do not retry
400,401or403— the same request will fail identically. - Always log
order_idandmerchant_transaction_id; they are the fastest path to a support answer. - Treat a timeout as unknown, not failed — the transaction may exist. Check the dashboard before creating a replacement order.
Going live
-
Test from the sandbox form
Use the demo checkout in the merchant dashboard to run a live low-value transaction before wiring your own code.
-
Verify your return URL
Confirm your
callback_urlis reachable over HTTPS and handles a repeated hit without double-crediting an order. -
Check both charge modes
Run a payment in your configured settlement mode and confirm
amount = net_amount + charge_amountin the redirect parameters. -
Confirm the origin rule
Make sure production is calling from an approved domain or IP — this is the most common cause of a "works locally, fails live" report.
-
Reconcile
Compare a day of dashboard transactions against your own order table before going fully live.
FAQ
Is there an SDK or library?
No SDK is needed. The endpoint accepts a standard form-encoded POST, so any HTTP client works. The examples above cover HTML, PHP, Node.js and Python.
Do I have to use the legacy /api/create-payment URL?
No. That path still works for integrations already in production, but new code should post to /payment/checkout. Both reach the same implementation and apply the same credential, domain and IP checks.
How do I test without real money?
Use a low-value live transaction from the dashboard's demo checkout, or contact support for a sandbox account.
When is my wallet credited?
Immediately on a verified success — the credit happens in the callback, before the customer is forwarded back to your site.
Can the same transaction be credited twice?
No. Settlement is idempotent, so repeated callbacks or manual retries will not double-credit.
Why does the customer see a different amount than my order total?
Your account is in customer pays mode, which adds the transaction charge on top. Switch to merchant pays in the dashboard if you prefer the customer to be charged exactly the order total.
What happens during maintenance?
The gateway refuses new checkouts with a maintenance message and no pending transaction is created. Existing transactions are unaffected.