Skip to main content
POST
Update gateway score

Update Gateway Score

Use case

Records the observed transaction outcome for a previously selected gateway so auth-rate analytics can learn from real payment results.

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 /update-gateway-score
  • Parameters: none.
  • Body: JSON body with merchantId, paymentId, gateway and status, plus optional gatewayReferenceId, enforceDynamicRoutingFailure, txnLatency, errorInfo and isSmartRetry.

Example

Update gateway score

status must be a transaction status value - CHARGED, AUTHORIZATION_FAILED, AUTHENTICATION_FAILED, JUSPAY_DECLINED, FAILURE, and so on. Lowercase values such as success are rejected with a 400. Payment attributes (amount, currency, payment method, auth type) are not part of this payload - the engine already has them from the /decide-gateway call for this paymentId. Any unrecognised field is silently ignored, so a misspelled key fails quietly rather than erroring. Note in particular that latency goes in txnLatency.gatewayLatency, not latency.

Response

When errorInfo is supplied in the request and matches a gateway status map rule, the response also carries a gsm_info object describing the lookup result.

Notes

  • Do not call this after NTW_BASED_ROUTING just to record the selected debit network; debit audit comes from /decide-gateway analytics.
  • Call it after payment authorization completes, not before.

Authorizations

Authorization
string
header
required

JWT token obtained from /auth/login

Body

application/json
merchantId
string
required
Example:

"test_merchant"

gateway
string
required
Example:

"stripe"

paymentId
string
required
Example:

"pay_001"

status
enum<string>
required

Transaction status. Must be a TxnStatus value - lowercase values such as success are rejected with a 400.

Available options:
STARTED,
AUTHENTICATION_FAILED,
JUSPAY_DECLINED,
PENDING_VBV,
VBV_SUCCESSFUL,
AUTHORIZED,
AUTHORIZATION_FAILED,
CHARGED,
AUTHORIZING,
COD_INITIATED,
VOIDED,
VOID_INITIATED,
NOP,
CAPTURE_INITIATED,
CAPTURE_FAILED,
VOID_FAILED,
AUTO_REFUNDED,
PARTIAL_CHARGED,
TO_BE_CHARGED,
PENDING,
FAILURE,
DECLINED
Example:

"CHARGED"

gatewayReferenceId
string
Example:

"stripe_ref_001"

enforceDynamicRoutingFailure
boolean
default:false
txnLatency
object | null

Observed gateway latency, in milliseconds.

errorInfo
object | null

Gateway error details for the GSM-based scoring filter. When present and the merchant flag is on, user/issuer-originated failures are skipped so the gateway is not penalised.

isSmartRetry
boolean | null

Set by the orchestrator when this call is a smart-retry attempt.

Response

200 - application/json

Score updated

message
string
merchant_id
string
gateway
string
payment_id
string
gsm_info
object | null

GSM lookup result. Present only when errorInfo was supplied and a matching rule was found.