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.

DomainRoleDescription
https://railona.comMarketing & DocsProduct overview and this integration guide (/docs/)
https://supplier.railona.com/adminMerchant DashboardApplications, sign-in, projects, key rotation, reconciliation, and payouts
https://api.railona.comPayment GatewayOpenAPI /v1/*, hosted checkout /checkout/:id, Payment Links /l/:slug, EPay /submit.php
https://admin.railona.com/adminPlatform OperationsInternal operations and finance console only—not for merchant sign-in
1Submit applicationProvide company or individual details, website URL, and email
2Approval emailOnce approved, dashboard sign-in unlocks and activation email arrives
3Retrieve keysCopy your Live/Test API Keys, Webhook Secret, and 8-digit EPay PID
4Configure projectEnable payment methods, set underpayment tolerance, and default callbacks
5Validate in Test ModeSimulate orders, payments, and webhook signatures with zero real funds
6Go liveSwitch to sk_live_ keys with T+1 payouts or direct settlement

Step 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.

FieldCompany (COMPANY)Individual / Indie (INDIVIDUAL)
Legal NameRegistered 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)
ContactContact person + Telegram / WeChat / phone (required)Telegram / WeChat / phone (required)
Display Name & URLCheckout brand name + https:// website (required)Same (required)
Business DescriptionProducts/services sold, estimated monthly volume, settlement modeSame
Email & PasswordApproval email address + 8–72 char password (required)Same (required)
Review & Activation: Newly submitted accounts enter 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:

  1. Enable Two-Factor Authentication (2FA): Go to Account & Settings → Security and bind an authenticator app (2FA is required for payouts and adding withdrawal addresses).
  2. 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.
  3. 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.15 USD).
  4. 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/18
Upstream requirements: Alipay Official requires alipay_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 SettingValue
Gateway URLhttps://api.railona.com/
Merchant ID (PID)8-digit number from Dashboard → Developers
Merchant KeyFrom Dashboard → Developers (epay_...)
Callback URLLeave 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 (returns code=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=1 indicates paid)
EPay type ParameterMapped Railona Payment Method
alipayAlipay
wxpay / wechatWeChat Pay
stripe / cardGlobal Cards (Stripe)
usdt / bep20 / bsc / usdt_bscUSDT · BSC (BEP-20)
usdc_bscUSDC · BSC (BEP-20)
trc20 / tron / usdt_tron / epusdtUSDT · TRON (TRC-20)
usdc_tronUSDC · TRON (TRC-20)
erc20 / eth / usdt_eth / usdc_ethUSDT / USDC · Ethereum (ERC-20)
sol / solana / usdt_sol / usdc_solUSDT / 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

ParameterTypeDescription
mch_order_nostringYour unique merchant order ID; repeated identical calls are idempotent, while conflicting amounts return 409
amountstringDecimal amount string (e.g. "29.90"); optional when passing a fixed price_id
currencystringPricing currency: USD (default) or CNY
subjectstringOrder title shown at the top of hosted checkout
payment_methodstringOptional; omit to let the buyer choose on checkout, or specify to receive an immediate active_attempt QR/deposit address
customerobjectOptional: {"id": "u_42", "email": "buyer@example.com"}
metadataobjectOptional: arbitrary JSON passed through verbatim in webhooks
notify_url / return_urlstringOptional: override project-level async webhook and browser redirect URLs
expires_inintOptional: 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 (:id accepts either intent_id or mch_order_no and returns the intent plus all attempts)
  • 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 dynamic price_data amounts as well as catalog price + quantity mapping.
  • GET https://api.railona.com/v1/checkout/sessions/:id: Retrieve session status.
  • Successful payments emit a standard checkout.session.completed webhook carrying both Stripe-Signature and X-PayHub-Signature headers.
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.url

Step 4: Webhooks, HMAC Verification & Idempotency

Security principle: Never fulfill orders based solely on browser redirects (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

HeaderDescription
X-PayHub-SignatureSignature formatted as t=<unix_ts>,v1=<hmac_sha256_hex> (includes two v1 signatures during secret rotation)
Stripe-SignatureIdentical to X-PayHub-Signature for drop-in official Stripe SDK verification
X-PayHub-Eventpayment.succeeded / payment.exception / payment.expired / payment.refunded / payment.test / checkout.session.completed
X-PayHub-DeliveryGlobally 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);
  });
}

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

NetworkMethod CodeDecimals / ConfirmationsMatching Mechanism
BSC (BEP-20)usdt_bsc / usdc_bsc18 decimals · 3 confsUnique decimal suffix + optional PayRouter one-click wallet pay
TRON (TRC-20)usdt_tron / usdc_tron6 decimals · 1 conf2D matrix suffix lock (address × amount suffix)
Ethereum (ERC-20)usdt_eth / usdc_eth6 decimals · 3 confsUnique decimal suffix + optional PayRouter one-click wallet pay
Solana (SPL)usdt_sol / usdc_sol6 decimals · finalizedUnique 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 to EXCEPTION_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_LATE and 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.

Pre-Launch Checklist