The post has been translated automatically. Original language: Russian
Connectivity of modules in a payment system arises not only through network requests, but also through common data models. And most often , architectural problems here come from the outside — from external contractors, whose releases we do not influence.
Let 's say an external payment provider or acquiring bank has updated the API and added a new interim status (for example, pending_3ds_review) or a specific opt-out code. The integration gateway carefully accepted the response and "transparently" passed it on to the event bus or internal services.
What happens next if there is no single contract in the architecture?:
The delay module does not recognize the new error code, considers it a temporary network failure, and begins endlessly repeating a bad payment, creating an unnecessary burden and risking duplicates.
The notification module does not find a template for an unfamiliar status and shows the user an incomprehensible technical plug instead of a clear explanation of the reason for the failure.
Analytics and reconciliation classify the operation as an "Unknown Failure", which distorts the real conversion funnel and prevents the degradation of a particular payment channel from being noticed in time.
Financial accounting and billing can be stuck in an uncertain state if the status does not relate to either final success or final failure.
Decision — canonical Status and Error Model (Canonical Data Model)
In order for a local change in one partner not to cause a domino effect in the entire system, external dialects must be isolated on the perimeter.:
Mapping is strictly on the border. External responses from providers should be translated into the internal dictionary of the payment system directly in the gateway adapter (Anti-Corruption Layer). No raw code of the bank or gateway should leak into the system core.
A single internal standard. All internal services — the orchestrator, billing, notifications, anti—fraud, and reporting - operate exclusively with their own strictly defined statuses (for example: CREATED, PROCESSING, REQUIRES_ACTION, SUCCEEDED, FAILED) and unified error categories (business failure, technical failure, anti-fraud, timeout).
Predictable fallback. If the provider has sent a completely unknown code, the adapter must set it to a secure internal default status (for example, UNKNOWN_TEMPORARY or send for manual parsing) and immediately send an alert to the development team without breaking the logic of neighboring modules.
Contract versioning. Any extension of the internal status model goes through schema versioning (Protobuf, Avro, JSON Schema) so that event consumers are updated in a controlled manner rather than learning about changes from overnight production incidents.
Conclusion: in fintech, an integration gateway is not just a "pipe" for forwarding JSON responses. It is a translator that protects internal business logic from external chaos. The tighter the boundary between external APIs and the internal language of the system, the cheaper it is to connect each new provider.
Связность модулей в платежной системе возникает не только через сетевые запросы, но и через общие модели данных. И чаще всего архитектурные проблемы здесь приходят снаружи — от внешних контрагентов, на релизы которых мы не влияем.
Допустим, внешний платежный провайдер или банк-эквайер обновил API и добавил новый промежуточный статус (например, pending_3ds_review) или специфический код отказа. Интеграционный шлюз аккуратно принял ответ и «прозрачно» передал его дальше по шине событий или внутренним сервисам.
Что происходит дальше, если в архитектуре нет единого контракта:
Модуль ретраев не распознает новый код ошибки, считает его временным сетевым сбоем и начинает бесконечно повторять безнадежный платеж, создавая лишнюю нагрузку и рискуя дублями.
Модуль уведомлений не находит шаблон под незнакомый статус и показывает пользователю непонятную техническую заглушку вместо внятного объяснения причины отказа.
Аналитика и сверка (reconciliation) записывают операцию в категорию «Неизвестный сбой», что искажает реальную воронку конверсии и мешает вовремя заметить деградацию конкретного платежного канала.
Финансовый учет и биллинг могут зависнуть в неопределенном состоянии, если статус не относится ни к финальному успеху, ни к финальному отказу.
Решение — каноническая модель статусов и ошибок (Canonical Data Model)
Чтобы локальное изменение у одного партнера не вызывало эффект домино во всей системе, внешние диалекты нужно изолировать на периметре:
Маппинг строго на границе. Внешние ответы провайдеров должны транслироваться во внутренний словарь платежной системы прямо в адаптере шлюза (Anti-Corruption Layer). Ни один сырой код банка или шлюза не должен утекать в ядро системы.
Единый внутренний стандарт. Все внутренние сервисы — оркестратор, биллинг, нотификации, антифрод и отчетность — работают исключительно со своими, строго зафиксированными статусами (например: CREATED, PROCESSING, REQUIRES_ACTION, SUCCEEDED, FAILED) и унифицированными категориями ошибок (бизнес-отказ, технический сбой, антифрод, таймаут).
Предсказуемый fallback. Если провайдер прислал абсолютно неизвестный код, адаптер обязан перевести его в безопасный внутренний статус по умолчанию (например, UNKNOWN_TEMPORARY или отправить на ручной разбор) и сразу отправить алерт команде разработки, не ломая логику соседних модулей.
Версионирование контрактов. Любое расширение внутренней модели статусов проходит через версионирование схем (Protobuf, Avro, JSON Schema), чтобы потребители событий обновлялись контролируемо, а не узнавали об изменениях из ночных инцидентов в продакшене.
Вывод: в финтехе интеграционный шлюз — это не просто «труба» для пересылки JSON-ответов. Это переводчик, который защищает внутреннюю бизнес-логику от внешнего хаоса. Чем жестче граница между внешними API и внутренним языком системы, тем дешевле обходится подключение каждого нового провайдера.
Comments 1
Newest Popular