Skip to main content
POST
/
routing
/
evaluate
Routing - Evaluate
curl --request POST \
  --url https://sandbox.hyperswitch.io/routing/evaluate \
  --header 'Content-Type: application/json' \
  --header 'api-key: <api-key>' \
  --data '
{
  "paymentInfo": {
    "paymentId": "pay_12345",
    "amount": "100",
    "currency": "USD",
    "paymentType": "ORDER_PAYMENT",
    "metadata": "metadata",
    "paymentMethodType": "upi",
    "paymentMethod": "upi",
    "cardIsin": "424242"
  },
  "merchantId": "pro_aMoPnEkgCVnh2WVsFe32",
  "eligibleGatewayList": "[\"stripe:mca_123\", \"adyen:mca_456\"]",
  "rankingAlgorithm": "SR_BASED_ROUTING",
  "eliminationEnabled": true
}
'
{
  "decided_gateway": "stripe:mca1",
  "gateway_priority_map": {
    "adyen:mca2": 1,
    "stripe:mca1": 1
  },
  "filter_wise_gateways": {},
  "priority_logic_tag": "<string>",
  "routing_approach": "SR_SELECTION_V3_ROUTING",
  "gateway_before_evaluation": "adyen:mca2",
  "priority_logic_output": {
    "isEnforcement": false,
    "gws": [
      "stripe:mca1",
      "adyen:mca2"
    ],
    "priorityLogicTag": "<string>",
    "gatewayReferenceIds": {},
    "primaryLogic": {
      "name": "success_rate_logic",
      "status": "success",
      "failure_reason": "insufficient_data"
    },
    "fallbackLogic": {
      "name": "success_rate_logic",
      "status": "success",
      "failure_reason": "insufficient_data"
    }
  },
  "reset_approach": "NO_RESET",
  "routing_dimension": "ORDER_PAYMENT, UPI, upi",
  "routing_dimension_level": "PM_LEVEL",
  "is_scheduled_outage": false,
  "is_dynamic_mga_enabled": false,
  "gateway_mga_id_map": {}
}

Authorizations

api-key
string
header
required

Use the API key created under your merchant account from the HyperSwitch dashboard. API key is used to authenticate API requests from your merchant server only. Don't expose this key on a website or embed it in a mobile application.

Body

application/json

Request to decide the optimal gateway for routing a payment

paymentInfo
object
required

Payment information used for routing decision-making

merchantId
string
required

Profile ID of the merchant

Example:

"pro_aMoPnEkgCVnh2WVsFe32"

eligibleGatewayList
string[] | null

List of eligible gateways for routing consideration

Example:

"[\"stripe:mca_123\", \"adyen:mca_456\"]"

rankingAlgorithm
enum<string>
Available options:
SR_BASED_ROUTING,
PL_BASED_ROUTING,
NTW_BASED_ROUTING
eliminationEnabled
boolean | null

Whether elimination logic is enabled for filtering gateways

Example:

true

Response

Routing rules evaluated successfully

decided_gateway
string | null

The gateway decided by the routing engine

Example:

"stripe:mca1"

gateway_priority_map
object

Map of gateways with their priority scores

Example:
{ "adyen:mca2": 1, "stripe:mca1": 1 }
filter_wise_gateways
object

Gateways organized by filter criteria

priority_logic_tag
string | null

Tag identifying the priority logic used

routing_approach
string | null

The routing approach used for decision making

Example:

"SR_SELECTION_V3_ROUTING"

gateway_before_evaluation
string | null

The gateway that was evaluated before the final decision

Example:

"adyen:mca2"

priority_logic_output
object
reset_approach
string | null

The reset approach applied during routing

Example:

"NO_RESET"

routing_dimension
string | null

Dimensions used for routing decision (payment type, method, etc.)

Example:

"ORDER_PAYMENT, UPI, upi"

routing_dimension_level
string | null

Level at which routing dimension is evaluated

Example:

"PM_LEVEL"

is_scheduled_outage
boolean | null

Indicates if routing decision was affected by scheduled outage

Example:

false

is_dynamic_mga_enabled
boolean | null

Indicates if dynamic merchant gateway account is enabled

Example:

false

gateway_mga_id_map
object

Map of gateways to their MGA IDs