Xirag Payments
Smart Routing · Priority Logic

The router that argues back.

Every transaction is weighed against a named, versioned rule set — card brand, BIN, EMI, amount, currency, even custom merchant fields — before it ever reaches a gateway. Ties aren't broken by a coin flip; they're broken by live, Bayesian success-rate data.

Ported from MobiusPO's routing engine · Juspay-compatible condition DSL · Thompson-sampling SR routing
Priority Logic

One rule set decides where every rupee goes

A capability pre-filter runs behind every rule: a matched rule whose gateways can't actually process the transaction's method or currency cascades to the next rule instead of dead-ending.

India Smart Routing · ACTIVE
currency != INR RANK  Stripe (SR-based) → CCAvenue → Razorpay
is_emi = true RANK  PayU (SR-based) → Razorpay → HDFC PG
method_type = UPI and amount₹10,000 RANK  Razorpay (SR-based) → PayU
card_brand = RUPAY RANK  Razorpay (SR-based) → BillDesk → Atom PG
amount > ₹50,000 RANK  HDFC PG (SR-based) → Razorpay → ICICI PG
No rule matched HYBRID  9-gateway pool, weighted by live success rate
Simulating…
resolved to
 
Three selection modes

Rank, split, or hybrid — per rule

Every rule, and the default fallback, independently picks how its eligible gateways are chosen.

  1. 1StripeSR-based97%
  2. 2CCAvenue91%
  3. 3Razorpay96%

Declared priority order, with a working circuit breaker: if Stripe's live success rate drops below 70%, it's skipped in favor of the next healthy option — no rule edit required.

Razorpay 25% PayU 20% Juspay 15% HDFC PG 10% +5 more

Every slice here is SR-based — Xirag doesn't just honor the configured percentage, it multiplies each slice by that gateway's posterior-mean success rate relative to the pool average, so a degrading gateway sheds volume automatically.

80% fixed Razorpay
20% pool — one Thompson-sampling draw per gateway, highest wins

A fixed slice can cover a contractual minimum-volume commitment; whatever traffic remains is resolved by one Thompson-sampling draw from each SR-based gateway's Beta posterior each transaction.

The SR model

Success rate is a posterior, not a snapshot

Every gateway's routing weight is a Beta distribution — narrowing and shifting as real outcomes arrive, never a single static percentage.

0
93.0%
Governance

Nobody ships a routing change alone

A Priority Logic that misroutes traffic is a production incident — so creating and activating one is deliberately not a single-click action.

1
DraftBuilt and edited freely — requires a 2FA step-up (re-verified sign-in, < 5 min old) to create.
2
ApprovedA second person signs off — the maker can't approve or reject their own Priority Logic.
3
ActiveTakes live traffic. Activating one demotes whichever logic was previously live back to Approved — never deleted.

Every Priority Logic is versioned, and a delete only moves it to a recycling bin — retention configurable per merchant, or kept forever — nothing is destroyed outright.

Gateway fleet

47 gateways profiled in the capability registry

Onboard the processors your business already trusts — the routing engine treats every one of them as an interchangeable, rankable pool member.

GatewayBest forSuccess rate (prior)Status
RPRazorpayUPI · Card · EMI
96%
Healthy
STStripeCard · Wallet (international)
97%
Healthy
JPJuspayUPI · Card · EMI
97%
Healthy
CACAMSPayNetbanking · UPI · Card (hosted redirect)
93%
Healthy
PUPayUNetbanking · Wallet · EMI
93%
Healthy
HDHDFC PGCard · UPI · EMI
95%
Healthy
ICICICI PGCard · UPI · EMI
94%
Healthy
CCCCAvenueCard · UPI · Netbanking (GCC)
91%
Healthy
+ 39 more gateways in the capability registry — BillDesk, Atom PG, Adyen, PayPal, Cashfree, PhonePe…
Everything else that comes with it

The rest of the orchestration layer

Merchant dashboard & analytics

Every Priority Logic's performance is automatically compared against whichever one was live immediately before it.

Shareable payment links

One API call — amount, currency, description — returns a link or a hosted checkout session.

Hosted, signed checkout

Builds and signs the gateway's redirect envelope; card data transits in memory only, never persisted.

Encrypted gateway onboarding

Credentials are sealed with AES-256-GCM at rest, never resolved to a real adapter without an active config.

Idempotent charges & refunds

Every charge and refund call is idempotency-keyed, so a retried request can never double-charge.

Webhooks + Re-Query fallback

Every webhook is signature-verified before it's trusted; a Re-Query call resolves status even if a webhook never arrives.

Stop routing on a coin flip.