Gateway Command is a component of the Magento payment gateway that takes the payload required for a particular payment provider and sends, receives, and processes the provider’s response. For each operation (authorization, capture and so on) of a certain payment provider - a separate gateway command is added.
\Magento\Payment\Gateway\Command\GatewayCommand class is the default
CommandInterface implementation. It allows performing most of the operations implemented in the Magento sales management.
Adding gateway commands
For each particular integration with a payment provider, gateway commands are added using virtual types in dependency injection (DI) configuration.
In the following example the
BraintreeAuthorizeCommand gateway command is added. The command implements the “authorize” operation for the Braintree payment provider (
(The code sample is from Magento Open Source v2.1. Although the payment provider gateway was added in v2.0, the particular default implementation using the gateway were added in v2.1)
A gateway command must be configured with the following arguments:
requestBuilder: request builder, builds an array of provider-specific arguments using the order information.
client: gateway client, takes the provider-specific arguments and performs a low-level call to the provider.
Optional arguments :