#14520·hyperswitch

feat(analytics): expose intent flow fields, error reason and /info definitions

Author: kanikabansal08Created Sep 30, 2026Updated Sep 30, 2026

Context

Parent: juspay/hyperswitch-control-center-cloud#597 (self-serve analytics on the existing ClickHouse analytics). PR: #14496

Problem

  1. Intent metrics cannot be split by customer vs merchant-initiated payments. off_session and setup_future_usage are sent in the Kafka intent event and stored in ClickHouse payment_intents, but the analytics API does not expose them as dimensions or filters.
  2. PaymentDimensions::ErrorReason works on the raw payment_attempts table but is missing from the payments /info list, so clients cannot discover it.
  3. /info returns desc: "" for every metric and dimension.
  4. sanitize_sql_string_literal removes every space from IN (…) filter values, so values such as "do not honor", "Customer request" or issuer names never match. Escaping of ' and \ already prevents injection; the space removal only changes the value.

Changes

  • off_session and setup_future_usage added to PaymentIntentDimensions and PaymentIntentFilters, the result row and bucket identifier, and every intent metric; SQL and Postgres support for FutureUsage; listed in intent /info.
  • ErrorReason listed in payments /info.
  • One-line desc for every payment and payment intent metric and dimension. Intent dimensions that exist only on the sessionizer table say "Sessionized metrics only".
  • Spaces kept in filter values; escaping unchanged.

No Kafka, ClickHouse schema, migration or payment-flow change. All changes are additive.

Acceptance criteria

  • Intent metrics group and filter by off_session / setup_future_usage (e.g. filters: {"off_session": [true]}).
  • Payments /info lists error_reason; every metric and dimension in both /info responses has a non-empty desc.
  • A filter value with spaces matches the stored value; a value containing ' or \ stays inside the literal.
  • Existing requests return the same results as before.