Skip to main content
POST

Decide Gateway

Use case

Runs the core gateway decision flow for a payment. The same endpoint supports auth-rate routing, priority-list routing, debit/network routing, and network+SR hybrid routing.

Authentication

Protected. Send either Authorization: Bearer <jwt_token> or x-api-key: <api_key>. In sandbox, also send x-feature: decision-engine. For local development, start with:

Request

  • Method and path: POST /decide-gateway
  • Parameters: none.
  • Body: JSON body with merchantId, paymentInfo, eligibleGatewayList, and rankingAlgorithm. rankingAlgorithm must be one of SR_BASED_ROUTING, PL_BASED_ROUTING, NTW_BASED_ROUTING, or NTW_SR_HYBRID_ROUTING.

Example

SR based routing

Priority-list routing

Debit/network routing

Multi-objective routing

Network + SR hybrid routing

Response

Notes

  • Use backend enum strings exactly; camelCase values such as NtwBasedRouting are invalid.
  • Debit routing requires the merchant debit-routing flag to be enabled and debit metadata encoded as a JSON string in paymentInfo.metadata.
  • Multi-objective routing is not a rankingAlgorithm value: it is a cost-aware post-step on SR-based scoring, toggled per request with enableMultiObjective or per merchant with the multi_objective_routing_enabled feature flag. When it runs, the response carries a multi_objective_info block, and routing_approach becomes SR_SELECTION_MULTI_OBJECTIVE when a cheaper gateway wins on expected value.
  • A successful call emits analytics/audit events asynchronously.

Authorizations

Authorization
string
header
required

JWT token obtained from /auth/login

Body

application/json
merchantId
string
required
Example:

"test_merchant"

paymentInfo
object
required
eligibleGatewayList
string[]
required
Example:
rankingAlgorithm
enum<string>
required
Available options:
SR_BASED_ROUTING,
PL_BASED_ROUTING,
NTW_BASED_ROUTING,
NTW_SR_HYBRID_ROUTING
Example:

"SR_BASED_ROUTING"

eliminationEnabled
boolean
default:false
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

Gateway decision result

decided_gateway
string
Example:

"stripe"

routing_approach
string

Routing approach used. SR_SELECTION_MULTI_OBJECTIVE indicates the multi-objective post-step promoted a cheaper gateway over the SR head.

Example:

"SR_SELECTION_V3_ROUTING"

gateway_priority_map
object
Example:
routing_dimension
string
routing_dimension_level
string
reset_approach
string
is_scheduled_outage
boolean
is_rust_based_decider
boolean
debit_routing_output
object
latency
number
multi_objective_info
object | null

Populated when the multi-objective post-step ran (multi_objective_routing_enabled feature flag or enableMultiObjective request field, outside hedging). Null otherwise.