Get active payment methods list in Magento 2.

Magento 2, You can get list of active payment methods using Magento\Payment\Model\Config class.

You need to instantiate Config Class in the construct method of the class to fetch list of active payment methods.

Return methods are both online and offline Payment methods of a system. You can get it by simple code snippets.

Create Block file,

Call function in template file by below way,

Output is(Test in Magento 2.2.6),

You can get all payment methods in Magento 2 by, Get All Payment Methods in Magento 2.