Decide Gateway
Core routing decision API. Given a payment context and a list of eligible gateways, returns the optimal gateway to route to.
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 eitherAuthorization: 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, andrankingAlgorithm.rankingAlgorithmmust be one ofSR_BASED_ROUTING,PL_BASED_ROUTING,NTW_BASED_ROUTING, orNTW_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
NtwBasedRoutingare 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
rankingAlgorithmvalue: it is a cost-aware post-step on SR-based scoring, toggled per request withenableMultiObjectiveor per merchant with themulti_objective_routing_enabledfeature flag. When it runs, the response carries amulti_objective_infoblock, androuting_approachbecomesSR_SELECTION_MULTI_OBJECTIVEwhen a cheaper gateway wins on expected value. - A successful call emits analytics/audit events asynchronously.
Related
- Decide Gateway: SR Based Routing
- Decide Gateway: PL Based Routing
- Decide Gateway: Debit Routing
- Decide Gateway: Hybrid Routing
- Decide Gateway: Multi-Objective Routing
- Update Gateway Score
Authorizations
JWT token obtained from /auth/login
Body
"test_merchant"
SR_BASED_ROUTING, PL_BASED_ROUTING, NTW_BASED_ROUTING, NTW_SR_HYBRID_ROUTING "SR_BASED_ROUTING"
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
"stripe"
Routing approach used. SR_SELECTION_MULTI_OBJECTIVE indicates the multi-objective post-step promoted a cheaper gateway over the SR head.
"SR_SELECTION_V3_ROUTING"
Populated when the multi-objective post-step ran (multi_objective_routing_enabled feature flag or enableMultiObjective request field, outside hedging). Null otherwise.