Railona Integration Guide
End-to-end developer documentation covering merchant onboarding, approval activation, drop-in EPay, REST OpenAPI, Stripe Checkout compatibility, no-code Payment Links, HMAC-SHA256 webhooks, and four-chain USDT/USDC reconciliation.
Overview & Domain Architecture
Railona isolates responsibilities across four domains. All API calls, hosted checkouts, Payment Links, and EPay endpoints live on https://api.railona.com, while merchant sign-in and account management live on https://supplier.railona.com/admin.
| Domain | Role | Description |
|---|---|---|
https://railona.com | Marketing & Docs | Product overview and this integration guide (/docs/) |
https://supplier.railona.com/admin | Merchant Dashboard | Applications, sign-in, projects, key rotation, reconciliation, and payouts |
https://api.railona.com | Payment Gateway | OpenAPI /v1/*, hosted checkout /checkout/:id, Payment Links /l/:slug, EPay /submit.php |
https://admin.railona.com/admin | Platform Operations | Internal operations and finance console only—not for merchant sign-in |
sk_live_ keys with T+1 payouts or direct settlementStep 1: Onboarding Application & Review
Visit https://supplier.railona.com/admin#register, open the Apply tab, choose your entity type (Company or Individual), and submit your details.
| Field | Company (COMPANY) | Individual / Indie (INDIVIDUAL) |
|---|---|---|
| Legal Name | Registered legal entity name (required) | Applicant's full legal name (required) |
| Registration / ID No. | Business registration or tax ID (required) | National ID or passport number (optional, aids verification) |
| Contact | Contact person + Telegram / WeChat / phone (required) | Telegram / WeChat / phone (required) |
| Display Name & URL | Checkout brand name + https:// website (required) | Same (required) |
| Business Description | Products/services sold, estimated monthly volume, settlement mode | Same |
| Email & Password | Approval email address + 8–72 char password (required) | Same (required) |
PENDING_REVIEW and cannot sign in or accept live payments until approved. Once approved, Railona unlocks dashboard access and sends an activation email (if rejected, the email includes the reason so you can update and resubmit with the same email and password).
Step 2: Dashboard Setup & Credentials
After receiving your approval email, sign in at https://supplier.railona.com/admin. Railona automatically provisions your default project. Complete these four setup steps in order:
- Enable Two-Factor Authentication (2FA): Go to Account & Settings → Security and bind an authenticator app (2FA is required for payouts and adding withdrawal addresses).
- Copy your credentials: Go to Developers → Keys & Rotation and reveal plaintext keys to record
sk_live_...(Live API Key),sk_test_...(Test API Key),whsec_...(Webhook Secret), and your 8-digit EPay PID & EPay Key. - Enable payment rails & tolerance: Go to Developers → Payment Settings, toggle any of the 11 supported payment methods, and adjust the Web3 underpayment auto-approval tolerance (default
0.15USD). - Configure callbacks & branding: Set your default async webhook URL and return URL under Webhooks, and customize your brand name, HTTPS logo, and accent color under Checkout Branding.
Direct / Hybrid Mode: Connect Own Channels (Optional)
To settle directly into your own Alipay, WeChat Pay V3, Stripe, ZPay, or self-hosted Web3 wallets, open Own Channels and add credentials (all secrets are encrypted at rest with AES-256-GCM). Set your upstream provider webhook URL to:
https://api.railona.com/webhooks/<provider>/<channel_id>
# Examples:
# Alipay Official: https://api.railona.com/webhooks/alipay_official/12
# WeChat Pay V3: https://api.railona.com/webhooks/wechat_official/15
# Stripe: https://api.railona.com/webhooks/stripe/18alipay_public_key; WeChat Pay V3 requires platform_keys (WeChat public key ID or platform certificate serial mapped to PEM); Stripe must subscribe to checkout.session.completed, checkout.session.async_payment_succeeded, checkout.session.async_payment_failed, and checkout.session.expired.
3.1 EPay-Compatible Integration (new-api / one-api Zero-Code)
Designed for new-api, one-api, api-plus, Dujiaoka, V2Board, WHMCS, and any platform with a built-in EPay plugin. Enter three fields and go live without modifying code.
| Admin Setting | Value |
|---|---|
| Gateway URL | https://api.railona.com/ |
| Merchant ID (PID) | 8-digit number from Dashboard → Developers |
| Merchant Key | From Dashboard → Developers (epay_...) |
| Callback URL | Leave blank—your site passes notify_url automatically on each order |
Endpoints & type Payment Method Mapping
- Redirect checkout:
GET/POST https://api.railona.com/submit.php(verifies signature, then redirects upstream or to hosted checkout) - Server-to-server order:
POST https://api.railona.com/mapi.php(returnscode=1,trade_no,qrcode,payurl) - Order lookup:
GET https://api.railona.com/api.php?act=order&pid=PID&key=KEY&out_trade_no=ORDER_NO(status=1indicates paid)
EPay type Parameter | Mapped Railona Payment Method |
|---|---|
alipay | Alipay |
wxpay / wechat | WeChat Pay |
stripe / card | Global Cards (Stripe) |
usdt / bep20 / bsc / usdt_bsc | USDT · BSC (BEP-20) |
usdc_bsc | USDC · BSC (BEP-20) |
trc20 / tron / usdt_tron / epusdt | USDT · TRON (TRC-20) |
usdc_tron | USDC · TRON (TRC-20) |
erc20 / eth / usdt_eth / usdc_eth | USDT / USDC · Ethereum (ERC-20) |
sol / solana / usdt_sol / usdc_sol | USDT / USDC · Solana (SPL) |
MD5 Signing & Async Callback
Signing rule: Exclude sign, sign_type, and empty values, sort remaining keys in ascending ASCII order as k1=v1&k2=v2, append your EpayKey directly to the end, and compute the 32-char lowercase MD5 hash. Upon payment, Railona sends a GET request to notify_url. After verifying the signature and crediting idempotently, your server must return HTTP 200 with plain text success.
import crypto from 'node:crypto';
export function signEpayMD5(params, epayKey) {
const qs = Object.keys(params)
.filter((k) => k !== 'sign' && k !== 'sign_type' && params[k] !== '' && params[k] != null)
.sort()
.map((k) => `${k}=${params[k]}`)
.join('&');
return crypto.createHash('md5').update(qs + epayKey).digest('hex');
}
// Express async callback handler
app.get('/pay/epay-notify', (req, res) => {
const expected = signEpayMD5(req.query, process.env.RAILONA_EPAY_KEY);
const got = String(req.query.sign || '').toLowerCase();
if (!got || got.length !== expected.length || !crypto.timingSafeEqual(Buffer.from(got), Buffer.from(expected))) {
return res.status(400).send('invalid sign');
}
if (req.query.trade_status === 'TRADE_SUCCESS') {
// Fulfill idempotently using req.query.out_trade_no
}
return res.status(200).send('success');
});3.2 Standard REST OpenAPI (Recommended for New Projects)
Authenticate with Authorization: Bearer sk_live_... (recommended), X-API-Key, or HTTP Basic Auth. Passing sk_test_... automatically routes orders through Test Mode.
Create a Payment Intent POST https://api.railona.com/v1/payment_intents
| Parameter | Type | Description |
|---|---|---|
mch_order_no | string | Your unique merchant order ID; repeated identical calls are idempotent, while conflicting amounts return 409 |
amount | string | Decimal amount string (e.g. "29.90"); optional when passing a fixed price_id |
currency | string | Pricing currency: USD (default) or CNY |
subject | string | Order title shown at the top of hosted checkout |
payment_method | string | Optional; omit to let the buyer choose on checkout, or specify to receive an immediate active_attempt QR/deposit address |
customer | object | Optional: {"id": "u_42", "email": "buyer@example.com"} |
metadata | object | Optional: arbitrary JSON passed through verbatim in webhooks |
notify_url / return_url | string | Optional: override project-level async webhook and browser redirect URLs |
expires_in | int | Optional: lifetime in seconds, defaults to 1800 (30 minutes) |
curl -X POST https://api.railona.com/v1/payment_intents \
-H "Authorization: Bearer sk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"mch_order_no": "ORD-20261203-0001",
"amount": "29.90",
"currency": "USD",
"subject": "API Credit Top-up",
"customer": { "id": "user_42", "email": "buyer@example.com" },
"metadata": { "plan": "pro" },
"notify_url": "https://your-site.com/api/pay/webhook",
"return_url": "https://your-site.com/orders/ORD-20261203-0001"
}'
# 200 OK response
{
"intent_id": "pi_8F2kQ7a9c1...",
"mch_order_no": "ORD-20261203-0001",
"amount": "29.90",
"currency": "USD",
"status": "PENDING",
"exception_status": "NONE",
"checkout_url": "https://api.railona.com/checkout/pi_8F2kQ7a9c1...",
"expires_at": 1796234400
}Order Lookups & Product Catalog
- Retrieve an order:
GET https://api.railona.com/v1/payment_intents/:id(:idaccepts eitherintent_idormch_order_noand returns the intent plus allattempts) - List products & prices:
GET https://api.railona.com/v1/products?page=1&page_size=50
3.3 Stripe Checkout Compatibility
If your app already uses Stripe Checkout, simply point the Stripe SDK host to api.railona.com and swap in your Railona API Key (sk_live_...)—no handler rewrite required.
POST https://api.railona.com/v1/checkout/sessions: Supports dynamicprice_dataamounts as well as catalogprice+quantitymapping.GET https://api.railona.com/v1/checkout/sessions/:id: Retrieve session status.- Successful payments emit a standard
checkout.session.completedwebhook carrying bothStripe-SignatureandX-PayHub-Signatureheaders.
import Stripe from 'stripe';
const stripe = new Stripe(process.env.RAILONA_API_KEY, {
host: 'api.railona.com',
protocol: 'https',
});
const session = await stripe.checkout.sessions.create({
mode: 'payment',
client_reference_id: 'ORD-20261203-0002',
line_items: [{
price_data: {
currency: 'usd',
unit_amount: 2990,
product_data: { name: 'API Credit Top-up' },
},
quantity: 1,
}],
success_url: 'https://your-site.com/thanks',
metadata: { notify_url: 'https://your-site.com/api/stripe/webhook' },
});
// Redirect the buyer to session.url3.4 No-Code Payment Links
In the Merchant Dashboard, go to Payment Links → Create Payment Link. Choose fixed or custom-range pricing, expiration, max redemptions, and optional email collection. Once saved, share the hosted URL directly:
https://api.railona.com/l/<your-custom-slug>Step 4: Webhooks, HMAC Verification & Idempotency
return_url), which can be dropped or spoofed. Always verify server-side webhook signatures (or query the order API) and deduplicate using event_id / mch_order_no.
Webhook Headers
| Header | Description |
|---|---|
X-PayHub-Signature | Signature formatted as t=<unix_ts>,v1=<hmac_sha256_hex> (includes two v1 signatures during secret rotation) |
Stripe-Signature | Identical to X-PayHub-Signature for drop-in official Stripe SDK verification |
X-PayHub-Event | payment.succeeded / payment.exception / payment.expired / payment.refunded / payment.test / checkout.session.completed |
X-PayHub-Delivery | Globally unique event ID (evt_...) for idempotency checks |
OpenAPI Webhook Payload
{
"event_id": "evt_234567abcdef...",
"event_type": "payment.succeeded",
"created_at": 1796232600,
"data": {
"intent_id": "pi_8F2kQ7a9c1...",
"attempt_id": "pa_4K9mN2...",
"mch_order_no": "ORD-20261203-0001",
"request_amount": "29.90",
"request_currency": "USD",
"payable_amount": "29.910000",
"actual_paid": "29.910000",
"payable_currency": "USDT",
"payment_method": "usdt_tron",
"upstream_ref": "txhash...",
"exception_status": "NONE",
"metadata": { "plan": "pro" }
}
}HMAC-SHA256 Verification (Multi-v1 Rotation & Replay Protection)
Compute the lowercase hex HMAC-SHA256 of "{t}.{raw_body}" using your project Webhook Secret, and reject timestamps older than 300 seconds.
import crypto from 'node:crypto';
export function verifyRailonaSignature(rawBody, sigHeader, secret, toleranceSec = 300) {
if (!sigHeader || !secret) return false;
let ts = '';
const v1s = [];
for (const part of sigHeader.split(',')) {
const [k, v] = part.trim().split('=');
if (k === 't') ts = v;
if (k === 'v1' && v) v1s.push(v);
}
const tsNum = Number(ts);
if (!tsNum || !v1s.length) return false;
if (Math.abs(Math.floor(Date.now() / 1000) - tsNum) > toleranceSec) return false;
const expected = crypto.createHmac('sha256', secret).update(`${ts}.${rawBody}`).digest('hex');
const expBuf = Buffer.from(expected, 'utf8');
return v1s.some((sig) => {
const gotBuf = Buffer.from(sig, 'utf8');
return gotBuf.length === expBuf.length && crypto.timingSafeEqual(gotBuf, expBuf);
});
}import hashlib, hmac, time
def verify_railona_signature(raw_body: bytes, sig_header: str, secret: str, tolerance_sec: int = 300) -> bool:
if not sig_header or not secret:
return False
ts, v1s = "", []
for part in sig_header.split(","):
if "=" not in part:
continue
k, v = part.strip().split("=", 1)
if k == "t":
ts = v
elif k == "v1" and v:
v1s.append(v)
if not ts.isdigit() or not v1s:
return False
if abs(int(time.time()) - int(ts)) > tolerance_sec:
return False
signed = f"{ts}.".encode("utf-8") + raw_body
expected = hmac.new(secret.encode("utf-8"), signed, hashlib.sha256).hexdigest()
return any(hmac.compare_digest(sig, expected) for sig in v1s)func VerifyRailonaSignature(rawBody []byte, sigHeader, secret string, tolerance time.Duration) bool {
if sigHeader == "" || secret == "" { return false }
var tsStr string
var v1s []string
for _, part := range strings.Split(sigHeader, ",") {
kv := strings.SplitN(strings.TrimSpace(part), "=", 2)
if len(kv) != 2 { continue }
if kv[0] == "t" { tsStr = kv[1] }
if kv[0] == "v1" && kv[1] != "" { v1s = append(v1s, kv[1]) }
}
ts, err := strconv.ParseInt(tsStr, 10, 64)
if err != nil || len(v1s) == 0 { return false }
if d := time.Since(time.Unix(ts, 0)); tolerance > 0 && (d > tolerance || d < -tolerance) { return false }
mac := hmac.New(sha256.New, []byte(secret))
mac.Write([]byte(tsStr + "."))
mac.Write(rawBody)
expected := hex.EncodeToString(mac.Sum(nil))
for _, sig := range v1s {
if hmac.Equal([]byte(sig), []byte(expected)) { return true }
}
return false
}<?php
function verifyRailonaSignature(string $rawBody, string $sigHeader, string $secret, int $toleranceSec = 300): bool {
if ($sigHeader === '' || $secret === '') return false;
$ts = ''; $v1s = [];
foreach (explode(',', $sigHeader) as $part) {
$kv = explode('=', trim($part), 2);
if (count($kv) !== 2) continue;
if ($kv[0] === 't') $ts = $kv[1];
if ($kv[0] === 'v1' && $kv[1] !== '') $v1s[] = $kv[1];
}
if (!ctype_digit($ts) || empty($v1s)) return false;
if (abs(time() - (int)$ts) > $toleranceSec) return false;
$expected = hash_hmac('sha256', $ts . '.' . $rawBody, $secret);
foreach ($v1s as $sig) {
if (hash_equals($expected, $sig)) return true;
}
return false;
}Retries & acknowledgment: Return any HTTP 2xx status to acknowledge delivery. Timeouts or non-2xx responses automatically retry 6 times at 15s → 1m → 5m → 30m → 2h → 6h. Inspect response codes or manually replay deliveries anytime in Webhook Logs.
Step 5: Order States, On-Chain Reconciliation & Exceptions
| Network | Method Code | Decimals / Confirmations | Matching Mechanism |
|---|---|---|---|
| BSC (BEP-20) | usdt_bsc / usdc_bsc | 18 decimals · 3 confs | Unique decimal suffix + optional PayRouter one-click wallet pay |
| TRON (TRC-20) | usdt_tron / usdc_tron | 6 decimals · 1 conf | 2D matrix suffix lock (address × amount suffix) |
| Ethereum (ERC-20) | usdt_eth / usdc_eth | 6 decimals · 3 confs | Unique decimal suffix + optional PayRouter one-click wallet pay |
| Solana (SPL) | usdt_sol / usdc_sol | 6 decimals · finalized | Unique decimal suffix + suffix-free Solana Pay Reference |
- Underpayment tolerance auto-approval: Shortfalls within the project threshold (default
$0.15) settle automatically at the received amount. Larger gaps transition toEXCEPTION_HOLD(PAID_PARTIAL) so you can use the reconciliation ruler to approve, wait for a top-up, or refund. - Late arrivals after expiry: Flagged as
PAID_LATEand held for manual review—never silently dropped after an order expires. - Unclaimed on-chain transfers: Mistyped amounts or duplicate transfers that don't match an active order are recorded in the unmatched pool with suggested candidate orders for one-click linking or refund.
Step 6: Test Mode Validation & Go-Live Checklist
Always validate the full end-to-end flow in Test Mode before switching to live traffic. Test orders move zero real funds and create no production ledger entries:
- One-click 5-step self-test: Go to Developers → Integration & Verification and click Run Test Order to automatically create an order, simulate settlement, and deliver a signed webhook to your endpoint.
- Code-level testing: Send real requests using
sk_test_..., toggle Test Mode in the dashboard, and manually simulate Succeeded / Underpaid / Late outcomes. - Zero-downtime key rotation: Rotate your API Key, Webhook Secret, or EPay Key under Keys & Rotation with a 24h or 72h dual-key grace window.
- Settlement & payouts: Platform-collected orders move from Pending to Available on a default T+1 cycle and withdraw to TRC-20, BEP-20, ERC-20, or Solana. New withdrawal addresses enforce a 24-hour cooldown and require 2FA.