#14276·hyperswitch

fix(payouts): preserve merchant metadata when tracking gateway_system

Author: aniketburman014Created Sep 17, 2026Updated Sep 17, 2026

Merchant-provided metadata on payouts is silently replaced with {"gateway_system": "direct"} after the payout is processed, causing all merchant fields (e.g. businessUnit, country, clientId) to disappear from the dashboard.

Root cause: Two PRs combined to produce the bug:

  • #11683 introduced update_gateway_system_in_payout_metadata which parsed merchant metadata as FeatureMetadata, silently dropping all unknown keys via serde, then wrote back only {"gateway_system": "direct"} — overwriting the entire field in memory.
  • #13586 changed the DB update from StatusUpdate to StatusAndMetadataUpdate, which started flushing this corrupted in-memory value to the database.

Affected scope: All card payouts (all connectors) and Deutschebank bank payouts, since StatusAndMetadataUpdate is only triggered for payout types that go through the eligibility check.