Magento 2 – Reason Behind Deprecation of Payment Method Class

deprecatedmagento-2.0.6magento-2.1paymentpayment-methods

In payment methods

\Magento\Payment\Model\Method\AbstractMethod

\Magento\Payment\Model\Method\Cc

both are deprecated.

In stead to extends both method now as per this link , we should implements

\Magento\Payment\Model\MethodInterface

Is there any specific reason for deprecated both class ? because if we implements interface we have to defined all methods in our base class, and its lots of other work added for payment gateway developers.

I am looking for brief explanations with reasons if any have idea about that.

Best Answer

Magento provides new way for payment integrations - Magento Payment Provider Gateway.

The \Magento\Payment\Model\Method\AbstractMethod is too complicated for customization, requires using inheritance instead of composition and code duplication for customizations. New infrastructure solves these issues.

To do not support both approaches the AbstractMethod has been deprecated in 2.1.0 release and will be removed in some of the next product major releases (it has not been removed to don't break backward compatibility and give time for 3rd party developers to move their extensions).

Magento\Payment\Model\Method\Cc has been deprecated for two main reasons:

  1. It extends AbstractMethod.
  2. It doesn't follow PCI compliance (the most import).

As summary. In most cases, you don't need to implement \Magento\Payment\Model\MethodInterface all infrastructure already prepared for payment integrations. Magento payment integrations like Braintree, Cybersource, eWay, Worldpay, partially PayPal PayflowPro already use it.

Related Topic