# adyen/adyen-magento2 architecture

> Architecture diagram of the GitHub repository adyen/adyen-magento2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/adyen/adyen-magento2
- Repository: https://github.com/adyen/adyen-magento2

## Overview

1. This repository is a single Magento 2 module, `Adyen_Payment`, that plugs Adyen payments into Adobe Commerce. The architecture is shaped by Magento extension points: DI configuration, observers, plugins, blocks/templates, controllers, cron jobs, webhooks, GraphQL resolvers, REST APIs, and UI component providers.

2. The core business boundary is the payment integration layer under `Gateway/`. It builds Adyen API requests from Magento order/quote/payment data, sends them through HTTP clients, validates responses, and maps those responses back into Magento order state, status history, captures, refunds, cancels, donation flows, payment links, and POS cloud sync.

3. Frontend checkout integration lives primarily in `view/frontend/`, `Model/Ui/`, `Block/Checkout`, `Block/Form`, and `view/frontend/web/js`. Magento checkout renders Adyen-specific payment methods and components, while JavaScript models coordinate checkout state, payment component state, shipping/payment information, and success-page behavior.

4. Adminhtml functionality is a separate subsystem centered on `Controller/Adminhtml`, `Block/Adminhtml`, `Model/Config/Adminhtml`, and `view/adminhtml/`. It provides configuration wizard screens, merchant account setup, webhook testing, notifications, support forms, and custom system configuration fields for payment method settings and activation.

5. Webhook processing is a major backend flow. Incoming webhook requests hit `Controller/Webhook/Index`, are stored as `Notification` records, and are later processed by `Cron/WebhookProcessor` and the webhook helper/acceptor classes. This separates receipt of notifications from the actual order updates so processing can happen after Magento has created and persisted the order.

6. Persistence is handled through Magento resource models and repositories in `Model/ResourceModel`, `Model/Repository`, and `Model/Sales`. The module stores its own operational state such as notifications, payment responses, analytics events, checkout state data, and related creditmemo/invoice/order-payment records, rather than relying only on Magento sales tables.

7. The module has a distinct headless/API surface in `Api/`, `Model/Api/`, and `Model/Resolver/`. These interfaces and implementations expose Adyen functions such as payment methods retrieval, payment details, payment status, gift cards, donations, POS Cloud initiation, and state-data save/remove for GraphQL and REST consumers.

8. A second integration boundary is the asynchronous and scheduled processing layer. Cron jobs clean up analytics and state data, cancel expired orders, process queued notifications/webhooks, and refresh Adyen server IPs for validation. There is also a queue-based notification publisher/consumer path under `Model/Queue/Notification` for decoupled processing.

9. Observers and plugins form the Magento adaptation layer. Observers attach Adyen data to quotes/orders/invoices/credit memos and adjust order state after payment. Plugins intercept checkout, REST, GraphQL, multishipping, vault, and instant purchase flows to keep Adyen behavior consistent across Magento entry points.

10. Supporting subsystems include analytics/event submission, logging, and support tooling. `Model/AnalyticsEvent`, `Cron/SubmitAnalyticsEvents`, and logger handlers track operational events; dedicated admin support forms and email templates provide merchant-facing troubleshooting and configuration assistance.

11. The module supports multiple payment modes and domains: standard online cards, alternative payment methods, gift cards, Pay by Link, POS Cloud/in-store, partial payments, recurring/vault, and instant purchase. These variants are reflected in separate request builders, UI config providers, info blocks, and payment method renderers rather than being handled by one generic path.

12. The repository is heavily tested, with unit tests covering most service classes, plus API functional suites for GraphQL and WebAPI, and MFTF coverage for Magento UI flows. The `.github` directory also shows CI/CD pipelines for unit, REST, GraphQL, E2E, and Magento functional testing, which indicates the module’s architecture is validated across storefront, admin, and headless execution paths.

Main entry points: [`Gateway/Http/Client`](https://github.com/adyen/adyen-magento2/tree/main/Gateway/Http/Client) (HTTP clients), [`Gateway/Request`](https://github.com/adyen/adyen-magento2/tree/main/Gateway/Request) (Request builders), [`Model`](https://github.com/adyen/adyen-magento2/tree/main/Model) (Repositories), [`Model/Resolver`](https://github.com/adyen/adyen-magento2/tree/main/Model/Resolver) (GraphQL resolvers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_gateway["Gateway"]
  node_node_gateway_builders["Request builders<br/>request composition"]
  node_node_gateway_http["HTTP clients<br/>api transport"]
  node_node_gateway_responses["Response handlers<br/>state mapping"]
  node_node_gateway_validators["Validators<br/>response checks"]
  node_node_gateway_webhooks["Webhook handlers<br/>event handlers"]
end

subgraph group_group_frontend["Storefront"]
  node_node_frontend_checkout["Checkout UI<br/>storefront checkout"]
  node_node_frontend_models["Checkout models<br/>client state"]
  node_node_frontend_templates["Payment templates<br/>ui templates"]
  node_node_frontend_blocks["Payment blocks<br/>render blocks"]
end

subgraph group_group_admin["Admin"]
  node_node_admin_config["Config wizard<br/>admin configuration"]
  node_node_admin_support["Support tools<br/>merchant support"]
  node_node_admin_notifications["Notifications UI<br/>admin review"]
end

subgraph group_group_api["Headless API"]
  node_node_api_graphql["GraphQL resolvers<br/>headless queries"]
  node_node_api_rest["REST services<br/>service layer"]
end

subgraph group_group_async["Async Jobs"]
  node_node_async_cron["Cron jobs<br/>scheduled jobs"]
  node_node_async_queue["Notification queue<br/>async pipeline"]
end

subgraph group_group_persistence["Persistence"]
  node_node_persistence_repos[("Repositories<br/>domain storage")]
  node_node_persistence_resources[("Resource models<br/>db access")]
end

subgraph group_group_events["Magento Hooks"]
  node_node_hooks_observers["Observers<br/>magento events"]
  node_node_hooks_plugins["Plugins<br/>flow interception"]
  node_node_hooks_config["DI and events<br/>module wiring"]
end

node_node_hooks_config -->|"wires"| node_node_gateway_builders
node_node_hooks_config -->|"wires"| node_node_gateway_http
node_node_gateway_builders -->|"feeds"| node_node_gateway_http
node_node_gateway_http -->|"returns"| node_node_gateway_validators
node_node_gateway_http -->|"drives"| node_node_gateway_responses
node_node_gateway_webhooks -->|"stores"| node_node_persistence_repos
node_node_async_queue -->|"delivers"| node_node_gateway_webhooks
node_node_async_cron -->|"consumes"| node_node_async_queue
node_node_async_cron -->|"updates"| node_node_persistence_repos
node_node_api_graphql -->|"calls"| node_node_gateway_builders
node_node_api_graphql -.->|"shares"| node_node_api_rest
node_node_api_rest -->|"persists"| node_node_persistence_repos
node_node_frontend_checkout -->|"uses"| node_node_frontend_models
node_node_frontend_models -->|"prepares"| node_node_gateway_builders
node_node_frontend_blocks -->|"renders"| node_node_frontend_templates
node_node_hooks_observers -->|"writes"| node_node_persistence_repos
node_node_hooks_plugins -->|"adapts"| node_node_frontend_models
node_node_hooks_plugins -.->|"adapts"| node_node_api_graphql
node_node_admin_config -->|"configures"| node_node_hooks_config
node_node_admin_notifications -->|"reprocesses"| node_node_async_cron
node_node_admin_support -.->|"surfaces"| node_node_frontend_blocks

click node_node_gateway_builders "https://github.com/adyen/adyen-magento2/tree/main/Gateway/Request"
click node_node_gateway_http "https://github.com/adyen/adyen-magento2/tree/main/Gateway/Http/Client"
click node_node_gateway_responses "https://github.com/adyen/adyen-magento2/tree/main/Gateway/Response"
click node_node_gateway_validators "https://github.com/adyen/adyen-magento2/tree/main/Gateway/Validator"
click node_node_gateway_webhooks "https://github.com/adyen/adyen-magento2/tree/main/Helper/Webhook"
click node_node_frontend_checkout "https://github.com/adyen/adyen-magento2/tree/main/view/frontend/web/js/view/payment"
click node_node_frontend_models "https://github.com/adyen/adyen-magento2/tree/main/view/frontend/web/js/model"
click node_node_frontend_templates "https://github.com/adyen/adyen-magento2/tree/main/view/frontend/web/template/payment"
click node_node_frontend_blocks "https://github.com/adyen/adyen-magento2/tree/main/Block"
click node_node_admin_config "https://github.com/adyen/adyen-magento2/tree/main/Model/Config/Adminhtml"
click node_node_admin_support "https://github.com/adyen/adyen-magento2/tree/main/Controller/Adminhtml/Support"
click node_node_admin_notifications "https://github.com/adyen/adyen-magento2/tree/main/Controller/Adminhtml/Notifications"
click node_node_api_graphql "https://github.com/adyen/adyen-magento2/tree/main/Model/Resolver"
click node_node_api_rest "https://github.com/adyen/adyen-magento2/tree/main/Model/Api"
click node_node_async_cron "https://github.com/adyen/adyen-magento2/tree/main/Cron"
click node_node_async_queue "https://github.com/adyen/adyen-magento2/tree/main/Model/Queue/Notification"
click node_node_persistence_repos "https://github.com/adyen/adyen-magento2/tree/main/Model"
click node_node_persistence_resources "https://github.com/adyen/adyen-magento2/tree/main/Model/ResourceModel"
click node_node_hooks_observers "https://github.com/adyen/adyen-magento2/tree/main/Observer"
click node_node_hooks_plugins "https://github.com/adyen/adyen-magento2/tree/main/Plugin"
click node_node_hooks_config "https://github.com/adyen/adyen-magento2/tree/main/etc"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_node_gateway_builders,node_node_gateway_http,node_node_gateway_responses,node_node_gateway_validators,node_node_gateway_webhooks,node_node_hooks_observers,node_node_hooks_plugins,node_node_hooks_config toneBlue
class node_node_frontend_checkout,node_node_frontend_models,node_node_frontend_templates,node_node_frontend_blocks toneAmber
class node_node_admin_config,node_node_admin_support,node_node_admin_notifications toneMint
class node_node_api_graphql,node_node_api_rest toneRose
class node_node_async_cron,node_node_async_queue toneIndigo
class node_node_persistence_repos,node_node_persistence_resources toneTeal
```

## Components

### Gateway

Builds, sends, and interprets Adyen payment requests and responses.

- [Request builders](https://github.com/adyen/adyen-magento2/tree/main/Gateway/Request): request composition · Builds Adyen API payloads from Magento order, quote, and shopper data. · `Gateway/Request`
- [HTTP clients](https://github.com/adyen/adyen-magento2/tree/main/Gateway/Http/Client): api transport · Sends payment, capture, refund, cancel, donate, payment-link, and POS sync calls. · `Gateway/Http/Client`
- [Response handlers](https://github.com/adyen/adyen-magento2/tree/main/Gateway/Response): state mapping · Maps Adyen responses back into order state, histories, and payment outcomes. · `Gateway/Response`
- [Validators](https://github.com/adyen/adyen-magento2/tree/main/Gateway/Validator): response checks · Validates checkout, modification, payment-link, donate, and POS responses. · `Gateway/Validator`
- [Webhook handlers](https://github.com/adyen/adyen-magento2/tree/main/Helper/Webhook): event handlers · Dispatches webhook event types to domain-specific order and contract handlers. · `Helper/Webhook`

### Storefront

Checkout and customer-facing payment rendering and state handling.

- [Checkout UI](https://github.com/adyen/adyen-magento2/tree/main/view/frontend/web/js/view/payment): storefront checkout · Renders payment methods, forms, and success-page behavior for Adyen checkout. · `view/frontend/web/js/view/payment`
- [Checkout models](https://github.com/adyen/adyen-magento2/tree/main/view/frontend/web/js/model): client state · Coordinates checkout state, shipping/payment information, and component state. · `view/frontend/web/js/model`
- [Payment templates](https://github.com/adyen/adyen-magento2/tree/main/view/frontend/web/template/payment): ui templates · Provides Knockout templates for card, PM, vault, giftcard, and POS views. · `view/frontend/web/template/payment`
- [Payment blocks](https://github.com/adyen/adyen-magento2/tree/main/Block): render blocks · Supplies checkout, form, info, and customer-renderer blocks for storefront output. · `Block`

### Admin

Configuration, support, and merchant operations in Magento admin.

- [Config wizard](https://github.com/adyen/adyen-magento2/tree/main/Model/Config/Adminhtml): admin configuration · Wizard, system fields, and backend config models for activation and setup. · `Model/Config/Adminhtml`
- [Support tools](https://github.com/adyen/adyen-magento2/tree/main/Controller/Adminhtml/Support): merchant support · Admin support forms, notices, and email templates for troubleshooting and onboarding. · `Controller/Adminhtml/Support`
- [Notifications UI](https://github.com/adyen/adyen-magento2/tree/main/Controller/Adminhtml/Notifications): admin review · Lists webhook notifications and supports reprocessing and related admin actions. · `Controller/Adminhtml/Notifications`

### Headless API

GraphQL and REST-facing module services and resolvers.

- [GraphQL resolvers](https://github.com/adyen/adyen-magento2/tree/main/Model/Resolver): headless queries · Exposes payment methods, payment details, status, donations, giftcards, and POS actions. · `Model/Resolver`
- [REST services](https://github.com/adyen/adyen-magento2/tree/main/Model/Api): service layer · Implements REST and guest service contracts for payment methods, state data, and giftcards. · `Model/Api`

### Async Jobs

Cron, queue, and command-driven background processing.

- [Cron jobs](https://github.com/adyen/adyen-magento2/tree/main/Cron): scheduled jobs · Cleans analytics/state data, cancels orders, processes webhooks, and refreshes server IPs. · `Cron`
- [Notification queue](https://github.com/adyen/adyen-magento2/tree/main/Model/Queue/Notification): async pipeline · Publishes and consumes webhook notifications for decoupled processing. · `Model/Queue/Notification`

### Persistence

Module-owned repositories, resource models, and stored operational state.

- [Repositories](https://github.com/adyen/adyen-magento2/tree/main/Model): domain storage · Stores notifications, analytics events, payment responses, and sales-related Adyen records. · `Model`
- [Resource models](https://github.com/adyen/adyen-magento2/tree/main/Model/ResourceModel): db access · Implements persistence and collections for module-owned entities and sales extensions. · `Model/ResourceModel`

### Magento Hooks

Observers and plugins that adapt Magento flows to Adyen behavior.

- [Observers](https://github.com/adyen/adyen-magento2/tree/main/Observer): magento events · Attaches Adyen data to quotes, invoices, credit memos, orders, and analytics flows. · `Observer`
- [Plugins](https://github.com/adyen/adyen-magento2/tree/main/Plugin): flow interception · Intercepts checkout, REST, GraphQL, multishipping, vault, and instant purchase flows. · `Plugin`
- [DI and events](https://github.com/adyen/adyen-magento2/tree/main/etc): module wiring · Wires extension points through DI, events, webhooks, queue topology, and Magento config. · `etc`

## Connections

- DI and events → Request builders: wires · Dependency injection and configuration connect builders to services.
- DI and events → HTTP clients: wires · Configures transport clients and adapters.
- Request builders → HTTP clients: feeds · Request builders prepare payloads for HTTP transport.
- HTTP clients → Validators: returns · Raw Adyen responses are validated before processing.
- HTTP clients → Response handlers: drives · Transport results are mapped into Magento domain updates.
- Webhook handlers → Repositories: stores · Webhook processing persists notification and payment state.
- Notification queue → Webhook handlers: delivers · Queued notifications are passed to webhook acceptors and handlers.
- Cron jobs → Notification queue: consumes · Cron processes queued webhook notifications and cleanup jobs.
- Cron jobs → Repositories: updates · Scheduled tasks clean state data and analytics records.
- GraphQL resolvers → Request builders: calls · GraphQL mutations and queries trigger Adyen request preparation.
- GraphQL resolvers → REST services: shares · GraphQL and REST services share payment and state-data domain logic.
- REST services → Repositories: persists · Service contracts save and retrieve operational state.
- Checkout UI → Checkout models: uses · UI components rely on shared checkout models and state.
- Checkout models → Request builders: prepares · Checkout state is transformed into payment request data.
- Payment blocks → Payment templates: renders · Blocks render storefront payment and info templates.
- Observers → Repositories: writes · Observers store or update module-owned sales data.
- Plugins → Checkout models: adapts · Plugins adjust checkout and payment flows at Magento entry points.
- Plugins → GraphQL resolvers: adapts · Plugins alter GraphQL purchase and cart behaviors where needed.
- Config wizard → DI and events: configures · Admin setup drives module configuration and system wiring.
- Notifications UI → Cron jobs: reprocesses · Admin actions can trigger webhook reprocessing paths.
- Support tools → Payment blocks: surfaces · Support UI uses shared blocks and templates for admin-facing output.
