Skip to content

Magento_Payment

Payment Gateway Framework & Method Abstraction

The foundation for all payment processing in Magento. Provides the Gateway Command Pattern for building payment integrations, method configuration infrastructure, and the abstraction layer that powers checkout payment handling.

219
PHP Components
62
Gateway Classes
14
Credit Card Types
2
Plugins

Component Breakdown

Core Classes

  • API Interfaces4
  • Models54
  • Blocks14
  • Helpers2

Gateway Framework

  • Command Classes12
  • Http Client12
  • Data Objects10
  • Validators8

Extension Points

  • Observers3
  • Plugins2
  • Config/Response8
  • Error Mappers5

What This Module Does

Payment Gateway Framework

Implements the Gateway Command Pattern - a structured approach for building payment integrations. Commands (authorize, capture, void, refund) are executed through a command pool, with request builders, HTTP clients, response handlers, and validators working together.

  • CommandPool for operation routing
  • Request/Response builders
  • Extensible validation chain

Payment Method Abstraction

Provides base classes and interfaces for payment methods. The Model\Method\Adapter class connects legacy payment methods to the new Gateway framework, while AbstractMethod remains available for simpler implementations.

  • Method availability rules
  • Credit card type configuration
  • Checkout config providers

Key Architectural Concepts

Gateway Command Pattern

Each payment operation (authorize, capture, void, refund) is a separate Command class. Commands are composed of request builders, HTTP clients, response handlers, and validators.

Method Adapter

The Adapter class bridges the MethodInterface contract with Gateway commands. Configured entirely through di.xml virtual types - no PHP code required per method.

Vault Integration

Payment module provides hooks for Magento_Vault to store and reuse payment tokens. TokenUI components and PaymentTokenRepository enable saved cards.

Documentation Sections

Supported Credit Card Types

The module provides built-in support for 14 credit card types. These are configured in etc/payment.xml and can be extended by payment method modules.

VI
Visa
MC
MasterCard
AE
Amex
DI
Discover
JCB
JCB
DN
Diners
+7
More

Quick Reference

Namespace: Magento\Payment

Location: vendor/magento/module-payment

Config Path: payment/

Log File: var/log/payment.log