---
title: "Decide gateway"
method: POST
path: "/decide-gateway"
tags: ["Gateway Decision"]
---

# Decide gateway

`POST /decide-gateway`

Core routing decision API. Given a payment context and a list of eligible gateways, returns the optimal gateway to route to.

The engine applies a sequence of filters (currency, card brand, auth type, EMI, etc.) then scores remaining gateways using success rate history, elimination status, and contract obligations.

**Authentication:** Requires either JWT Bearer token or API Key.

## Request body

- DecideGatewayRequest
  - `merchantId` string, required
  - `paymentInfo` PaymentInfo, required
    - `paymentId` string, required
    - `amount` number, double, required
    - `currency` string, required
    - `paymentType` 'ORDER_PAYMENT' | 'MANDATE_REGISTER' | 'EMANDATE_REGISTER' | 'MANDATE_PAYMENT' | 'EMANDATE_PAYMENT' | 'TPV_PAYMENT' | 'TPV_EMANDATE_REGISTER' | 'TPV_MANDATE_REGISTER' | 'TPV_EMANDATE_PAYMENT' | 'TPV_MANDATE_PAYMENT' | 'PARTIAL_CAPTURE' | 'PARTIAL_VOID' | 'VAN_PAYMENT', required
    - `paymentMethodType` string, required
    - `paymentMethod` string, required
    - `country` string, nullable
    - `customerId` string, nullable
    - `udfs` string[], nullable — Positional user-defined fields.
    - `preferredGateway` string, nullable
    - `metadata` string, nullable — JSON-encoded string. Carries debit-routing inputs such as merchant_category_code, acquirer_country and co_badged_card_data.
    - `internalMetadata` string, nullable
    - `isEmi` boolean, nullable
    - `emiBank` string, nullable
    - `emiTenure` integer, nullable
    - `paymentSource` string, nullable
    - `authType` 'ATMPIN' | 'THREE_DS' | 'THREE_DS_2' | 'OTP' | 'OBO_OTP' | 'VIES' | 'NO_THREE_DS' | 'NETWORK_TOKEN' | 'MOTO' | 'FIDO' | 'CTP' | 'null', nullable
    - `cardIssuerBankName` string, nullable
    - `cardIsin` string, nullable
    - `cardType` 'AADHAAR' | 'ATM_CARD' | 'CASH' | 'CREDIT' | 'DEBIT' | 'NB' | 'PAYLATER' | 'PREPAID' | 'REWARD' | 'UPI' | 'WALLET' | 'VIRTUAL_ACCOUNT' | 'OTC' | 'RTP' | 'CRYPTO' | 'BLANK' | 'PAN' | 'null', nullable
    - `cardSwitchProvider` string, nullable — Card scheme / network.
    - `cardProgram` string, nullable
    - `cardIssuerCountry` string, nullable
    - `channel` string, nullable — Acceptance channel: ecom / pos / contactless. Feeds the interchange-category predictor.
  - `eligibleGatewayList` string[], required
  - `rankingAlgorithm` 'SR_BASED_ROUTING' | 'PL_BASED_ROUTING' | 'NTW_BASED_ROUTING' | 'NTW_SR_HYBRID_ROUTING', required
  - `eliminationEnabled` boolean
  - `enableMultiObjective` boolean — Per-request override for the multi-objective (cost-aware) post-step. true forces it on, false forces it off; omitted falls back to the merchant's multi_objective_routing_enabled feature flag.

## Response `200`

Gateway decision result

- DecidedGateway
  - `decided_gateway` string
  - `fallback_gateways` string[]
  - `gateway_priority_map` object, nullable
  - `filter_wise_gateways` object, nullable
  - `priority_logic_tag` string, nullable
  - `routing_approach` string — SR_SELECTION_MULTI_OBJECTIVE indicates the multi-objective post-step promoted a cheaper gateway over the SR head.
  - `gateway_before_evaluation` string, nullable — Gateway the SR head selected before the multi-objective / debit-routing post-step replaced it.
  - `priority_logic_output` object, nullable
  - `debit_routing_output` DebitRoutingOutput
    - `co_badged_card_networks_info` object[]
      - `network` string
      - `saving_percentage` number
    - `issuer_country` string
    - `is_regulated` boolean
    - `regulated_name` string, nullable
    - `card_type` string
  - `reset_approach` 'ELIMINATION_RESET' | 'SRV2_RESET' | 'SRV3_RESET' | 'NO_RESET' | 'SRV2_ELIMINATION_RESET' | 'SRV3_ELIMINATION_RESET'
  - `routing_dimension` string, nullable
  - `routing_dimension_level` string, nullable
  - `is_scheduled_outage` boolean
  - `is_dynamic_mga_enabled` boolean
  - `gateway_mga_id_map` object, nullable
  - `is_rust_based_decider` boolean
  - `latency` integer, nullable
  - `multi_objective_info` MultiObjectiveInfo — Present when the multi-objective (cost-aware) post-step ran. Explains why the gateway was picked: the SR head was kept (AUTH_WON) or a higher economic-value PSP was promoted (COST_WON). Economic value is auth rate × settlement value, where settlement value = txn amount − cost of payment processing (acquirer, issuer & network fee).
    - `outcome` 'COST_WON' | 'AUTH_WON'
    - `reason` string
    - `srHead` PspSummary
      - `psp` string
      - `authRate` number
      - `costBps` number, nullable
    - `chosen` PspSummary
      - `psp` string
      - `authRate` number
      - `costBps` number, nullable
    - `costSavedBps` number, nullable — Fee saved in bps when outcome is COST_WON (srHead.costBps - chosen.costBps).
    - `qualifiedCount` integer — Number of PSPs that had cost data and were ranked on expected value.
    - `margin` number — Merchant margin (fraction of ticket) applied for this transaction. Configured via the successRate config margin field; defaults to 1.0.
    - `evGapTop2` number, nullable — Expected-value gap between the top-two EV-ranked PSPs, as a fraction of ticket. Null when fewer than two PSPs had cost data.

## Other responses

- `400` — Bad request

---

[API](https://skmtc.net/juspay/apis/decision-engine.md) · [All operations](https://skmtc.net/juspay/apis/decision-engine/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/juspay/decision-engine/versions/36e7a0972ee6/schema)
