This section describes how to configure vault payment method and create payment actions, like authorize, sale (authorize & capture), capture and so on.
Example of the vault payment facade configuration for Braintree:
This virtual type is similar to the payment method facade. The main difference is the vaultProvider argument. As the Vault payment in the general case is a proxy, the specific payment provider must be specified.
Extend payment method configuration
To enable vault usage for the payment method, set the can_authorize_vault option in the method’s configuration.
Following is an example from Braintree configuration:
Add a gateway command for vault
For payment actions, you need to create gateway commands for vault, and update the payment provider command pool.
The following sample from Braintree configuration illustrates how to add the authorize payment action to command pool:
Add command manager
You also need to create a command manager for vault. It is configured with the payment integration command pool and allows performing payment commands in any place of code.
Example of adding a command manager for Braintree vault:
Command manager must be added to the command manager pool. This pool is available for vault instance and enables performing payment provider actions.
There are two ways to add command manager to the pool:
Add to default CommandManagerPool implementation. Example:
Create custom command manager pool. Example:
In the first case, this pool can be used in any module to perform vault payment commands. In the second case, only specific vault payment integration can use this pool.
You can use the samples as templates for your command manager configuration.You only need to change the Braintree-related names to your custom ones.