Decide Gateway
July 28, 2026 ยท View on GitHub
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:
export BASE_URL=http://localhost:8080
export AUTH_HEADER="Authorization: Bearer <jwt_token>"
# Sandbox only:
# export BASE_URL=https://sandbox.hyperswitch.io
# export FEATURE_HEADER="x-feature: decision-engine"
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
curl --location "$BASE_URL/decide-gateway" \
--header "$AUTH_HEADER" \
--header "Content-Type: application/json" \
--data '{
"merchantId": "merchant_demo",
"eligibleGatewayList": ["stripe", "adyen", "checkout"],
"rankingAlgorithm": "SR_BASED_ROUTING",
"eliminationEnabled": true,
"paymentInfo": {
"paymentId": "pay_sr_001",
"amount": 1000,
"currency": "USD",
"country": "US",
"paymentType": "ORDER_PAYMENT",
"paymentMethodType": "CARD",
"paymentMethod": "CREDIT",
"authType": "THREE_DS",
"cardIsin": "424242"
}
}'
Priority-list routing
curl --location "$BASE_URL/decide-gateway" \
--header "$AUTH_HEADER" \
--header "Content-Type: application/json" \
--data '{
"merchantId": "merchant_demo",
"eligibleGatewayList": ["stripe", "adyen", "checkout"],
"rankingAlgorithm": "PL_BASED_ROUTING",
"eliminationEnabled": true,
"paymentInfo": {
"paymentId": "pay_pl_001",
"amount": 1000,
"currency": "USD",
"country": "US",
"paymentType": "ORDER_PAYMENT",
"paymentMethodType": "CARD",
"paymentMethod": "CREDIT",
"authType": "THREE_DS",
"cardIsin": "424242"
}
}'
Debit/network routing
curl --location "$BASE_URL/decide-gateway" \
--header "$AUTH_HEADER" \
--header "Content-Type: application/json" \
--data '{
"merchantId": "merchant_demo",
"eligibleGatewayList": ["stripe", "adyen"],
"rankingAlgorithm": "NTW_BASED_ROUTING",
"paymentInfo": {
"paymentId": "pay_debit_001",
"amount": 1000,
"currency": "USD",
"country": "US",
"paymentType": "ORDER_PAYMENT",
"paymentMethodType": "CARD",
"paymentMethod": "DEBIT",
"authType": "THREE_DS",
"metadata": "{\"merchant_category_code\":\"merchant_category_code_0001\",\"acquirer_country\":\"US\",\"co_badged_card_data\":{\"card_type\":\"debit\",\"issuer_country\":\"US\",\"is_regulated\":false,\"regulated_name\":null,\"card_networks\":[\"VISA\",\"NYCE\",\"PULSE\",\"STAR\"]}}"
}
}'
Multi-objective routing
curl --location "$BASE_URL/decide-gateway" \
--header "$AUTH_HEADER" \
--header "Content-Type: application/json" \
--data '{
"merchantId": "merchant_demo",
"eligibleGatewayList": ["stripe", "adyen", "checkout"],
"rankingAlgorithm": "SR_BASED_ROUTING",
"eliminationEnabled": true,
"enableMultiObjective": true,
"paymentInfo": {
"paymentId": "pay_mo_001",
"amount": 1000,
"currency": "USD",
"country": "US",
"paymentType": "ORDER_PAYMENT",
"paymentMethodType": "CARD",
"paymentMethod": "CREDIT",
"authType": "THREE_DS",
"cardIsin": "424242"
}
}'
Network + SR hybrid routing
curl --location "$BASE_URL/decide-gateway" \
--header "$AUTH_HEADER" \
--header "Content-Type: application/json" \
--data '{
"merchantId": "merchant_demo",
"eligibleGatewayList": ["stripe", "adyen"],
"rankingAlgorithm": "NTW_SR_HYBRID_ROUTING",
"paymentInfo": {
"paymentId": "pay_hybrid_001",
"amount": 1000,
"currency": "USD",
"country": "US",
"paymentType": "ORDER_PAYMENT",
"paymentMethodType": "CARD",
"paymentMethod": "DEBIT",
"authType": "THREE_DS",
"metadata": "{\"merchant_category_code\":\"merchant_category_code_0001\",\"acquirer_country\":\"US\",\"co_badged_card_data\":{\"card_type\":\"debit\",\"issuer_country\":\"US\",\"is_regulated\":false,\"regulated_name\":null,\"card_networks\":[\"VISA\",\"NYCE\",\"PULSE\",\"STAR\"]}}"
}
}'
Response
{
"decided_gateway": "stripe",
"gateway_priority_map": {
"stripe": 0.94,
"adyen": 0.91
},
"routing_approach": "SR_SELECTION_V3_ROUTING",
"gateway_before_evaluation": "stripe",
"debit_routing_output": {
"co_badged_card_networks_info": [
{
"network": "NYCE",
"saving_percentage": 1.2
}
],
"issuer_country": "US",
"is_regulated": false,
"card_type": "debit"
},
"is_rust_based_decider": true
}
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.