---
title: "Get All Payment Methods in Magento 2"
url: "https://dolphinwebsolution.com/get-all-payment-methods-in-magento-2"
date: "2021-09-30T07:21:03+05:30"
modified: "2023-08-24T10:03:56+05:30"
author:
  name: "Jigar Patel"
categories:
  - "Magento"
word_count: 670
reading_time: "4 min read"
summary: "In Magento 2, a large number of payment methods internally and externally. I will show you how to get all payment methods in Magento 2.

Magento 2 supports different types of payment methods. To ..."
description: "In Magento 2, a large number of payment methods internally and externally. I will show you how to get all payment methods in Magento 2."
keywords: "All Payment Methods in Magento 2,All Payment Methods programmatically in Magento 2,All Payment Methods programmatically,all payment methods in magento,magento all payment method, Magento"
language: "en"
schema_type: "Article"
related_posts:
  - title: "How To Add Or Create Slide-out(Sliding) ,Modal Windows Panels in Magento 2"
    url: "https://dolphinwebsolution.com/how-to-add-or-create-slide-outsliding-modal-windows-panels-in-magento-2"
  - title: "How to create custom page layout in Magento 2."
    url: "https://dolphinwebsolution.com/how-to-create-custom-page-layout-in-magento"
  - title: "How to Create Sales Order Programmatically in Magento 2?"
    url: "https://dolphinwebsolution.com/create-sales-order-programmatically-in-magento-2"
---

# Get All Payment Methods in Magento 2

_Published: September 30, 2021_  
_Author: Jigar Patel_  

![](https://dolphinwebsolution.com/wp-content/uploads/2023/02/Get-All-Payment-Methods-in-Magento-2-1024x536.png)

In Magento 2, a large number of payment methods internally and externally. I will show you how to get all payment methods in Magento 2.

Magento 2 supports different types of payment methods. To check out, log into your Magento 2 Admin Panel. Navigate to **STORES > Configuration > Sales > Payment Methods.**

I will be showing two ways (Dependency Injection & Object Manager ) to get payment methods.

#### Use Dependency Injection:

Here is the code that you need to write in your Block class.

```
/**
 * Order Payment
 *
 * @var \Magento\Sales\Model\ResourceModel\Order\Payment\Collection
 */
protected $_orderPayment;

/**
 * Payment Helper Data
 *
 * @var \Magento\Payment\Helper\Data
 */
protected $_paymentHelper;

/**
 * Payment Model Config
 *
 * @var \Magento\Payment\Model\Config
 */
protected $_paymentConfig;

/**
 * @param \Magento\Backend\Block\Template\Context $context
 * @param \Magento\Sales\Model\ResourceModel\Order\Payment\Collection $orderPayment
 * @param \Magento\Payment\Helper\Data $paymentHelper
 * @param \Magento\Payment\Model\Config $paymentConfig
 * @param array $data
 */
public function __construct(
    \Magento\Backend\Block\Template\Context $context,
    \Magento\Sales\Model\ResourceModel\Order\Payment\Collection $orderPayment,
    \Magento\Payment\Helper\Data $paymentHelper,
    \Magento\Payment\Model\Config $paymentConfig,
    array $data = []
) {
    $this->_orderPayment = $orderPayment;
    $this->_paymentHelper = $paymentHelper;
    $this->_paymentConfig = $paymentConfig;
    parent::__construct($context, $data);
}

/**
 * Get all payment methods
 *
 * @return array
 */
public function getAllPaymentMethods()
{
    return $this->_paymentHelper->getPaymentMethods();
}

/**
 * Get key-value pair of all payment methods
 * key = method code & value = method name
 *
 * @return array
 */
public function getAllPaymentMethodsList()
{
    return $this->_paymentHelper->getPaymentMethodList();
}

/**
 * Get active/enabled payment methods
 *
 * @return array
 */
public function getActivePaymentMethods()
{
    return $this->_paymentConfig->getActiveMethods();
}

/**
 * Get payment methods that have been used for orders
 *
 * @return array
 */
public function getUsedPaymentMethods()
{
    $collection = $this->_orderPayment;
    $collection->getSelect()->group('method');
    $paymentMethods[] = array('value' => '', 'label' => 'Any');
    foreach ($collection as $col) {
        $paymentMethods[] = array('value' => $col->getMethod(), 'label' => $col->getAdditionalInformation()['method_title']);
    }
    return $paymentMethods;
}
```

#### Use Object Manager:
If you want to get a list and information of all available [payment methods](https://dolphinwebsolution.com/shop/magento-2-extensions/payment.html) on Magento programmatically you can use below mention code and you will get all payment method information.

```
$objectManager =  \Magento\Framework\App\ObjectManager::getInstance();

$paymentHelper = $objectManager->get('Magento\Payment\Helper\Data');
$allPaymentMethods = $paymentHelper->getPaymentMethods();
$allPaymentMethodsArray = $paymentHelper->getPaymentMethodList();

var_dump($allPaymentMethodsArray);
var_dump($allPaymentMethods);

$paymentConfig = $objectManager->get('Magento\Payment\Model\Config');
$activePaymentMethods = $paymentConfig->getActiveMethods();

var_dump(array_keys($activePaymentMethods));

$orderPaymentCollection = $objectManager->get('\Magento\Sales\Model\ResourceModel\Order\Payment\Collection');
$orderPaymentCollection->getSelect()->group('method');
$paymentMethods[] = array('value' => '', 'label' => 'Any');
foreach ($orderPaymentCollection as $col) {
    $paymentMethods[] = array('value' => $col->getMethod(), 'label' => $col->getAdditionalInformation()['method_title']);
}
var_dump($paymentMethods);
```

**Output:**

**getAllPaymentMethods():**

```
Array
(
    [free] => Array
        (
            [active] => 1
            [model] => Magento\Payment\Model\Method\Free
            [order_status] => pending
            [title] => No Payment Information Required
            [allowspecific] => 0
            [sort_order] => 1
            [group] => offline
        )

    [substitution] => Array
        (
            [active] => 0
            [model] => Magento\Payment\Model\Method\Substitution
            [allowspecific] => 0
        )

    [vault] => Array
        (
            [debug] => 1
            [model] => Magento\Vault\Model\VaultPaymentInterface
        )

    [checkmo] => Array
        (
            [active] => 1
            [model] => Magento\OfflinePayments\Model\Checkmo
            [order_status] => pending
            [title] => Check / Money order
            [allowspecific] => 0
            [group] => offline
        )

    [purchaseorder] => Array
        (
            [active] => 0
            [model] => Magento\OfflinePayments\Model\Purchaseorder
            [order_status] => pending
            [title] => Purchase Order
            [allowspecific] => 0
            [group] => offline
        )

    [banktransfer] => Array
        (
            [active] => 0
            [model] => Magento\OfflinePayments\Model\Banktransfer
            [order_status] => pending
            [title] => Bank Transfer Payment
            [allowspecific] => 0
            [group] => offline
        )

    [cashondelivery] => Array
        (
            [active] => 0
            [model] => Magento\OfflinePayments\Model\Cashondelivery
            [order_status] => pending
            [title] => Cash On Delivery
            [allowspecific] => 0
            [group] => offline
        )
```

**getAllPaymentMethodsList():**

```
Array
(
    [banktransfer] => Bank Transfer Payment
    [cashondelivery] => Cash On Delivery
    [checkmo] => Check / Money order
    [free] => No Payment Information Required
    [purchaseorder] => Purchase Order
)
```

**getUsedPaymentMethods()**:

```
Array
(
    [0] => Array
        (
            [value] =>
            [label] => Any
        )

    [1] => Array
        (
            [value] => cashondelivery
            [label] => Cash On Delivery
        )

    [2] => Array
        (
            [value] => checkmo
            [label] => Check / Money order
        )

)
```

I hope this instruction will be helpful for you.

If you have any difficulties regarding this blog, do consider them posting in the Comments section below!

I’m here to help. Thank you!


---

_View the original post at: [https://dolphinwebsolution.com/get-all-payment-methods-in-magento-2](https://dolphinwebsolution.com/get-all-payment-methods-in-magento-2)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-08-26 07:38:05 UTC_  
