3

I am working on custom payment module with Authorize technique using XML API based.

I need to use Magento out of box vault module to save customer card details. Any one have knowledge on this How Can I use this vault to save card.?

Thanks.

1

Add vault to module dependencies

You need to add dependencies on the Magento_Vault module in the payment method’s module.xml files.

Example: adding Vault module dependencies for the Braintree payment method

app/code/Magento/Braintree/etc/module.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Magento_Braintree" setup_version="2.0.0">
        <sequence>
            ...
            <module name="Magento_Vault"/>
            ...
        </sequence>
    </module>
</config>

Now configuration vault payment

You need to configure the main parameters of the vault implementation in the config.xml file of your payment method module:

model - instance of the vault payment implementation, configured in di.xml.

title - vault payment method title; can be overwritten in the store configuration.

These parameters are specified in the section defined by the unique vault implementation code. They are the minimum required to create vault payment. All other payment settings are inherited from the payment provider integration.

Additional configuration might be required depending on your implementation.

The following example is the config.xml file of the Braintree payment method:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
    <default>
        <payment>
            <braintree>
                <model>BraintreeFacade</model>
                ...
            </braintree>
            <braintree_cc_vault>
                <model>BraintreeCreditCardVaultFacade</model>
                <title>Stored Cards (Braintree)</title>
            </braintree_cc_vault>
        </payment>
    </default>
</config>

More at:

1) http://devdocs.magento.com/guides/v2.1/payments-integrations/vault/vault-di.html

2) Magento 2: How to set VaultProvider?

  • Hi, I am trying to add Vault to the payfort module by following the official doc devdocs.magento.com/guides/v2.1/payments-integrations/vault/…, but i cannot get the dependency injection correct. I tried to copy the di.xml from the braintree module but it is also very confusing. the code inside the VaultDetailsHandler which is used as handler is not getting executed. What is your opinion about using sales_order_payment_save_after or checkout_onepage_controller_success_action event observers to add token to vault – Sreejith Sasidharan Feb 5 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.