Magento: Get Payment Methods (All/Active/Used)
This article shows how to get payment methods in Magento 1. We will be fetching 3 types of payment methods. They are:
1) All Payment Methods
2) Active/Enabled Payment Methods
3) Payment Methods that have been used while placing orders
To get all payment methods, we can either use
Mage_Payment_Helper_DataorMage_Payment_Model_Configclass.To get active payment methods, we will be using
Mage_Payment_Model_Configclass.To get payment methods used in orders, we will be using
Mage_Sales_Model_Resource_Order_Payment_Collectionclass.
Get all payment methods
1 2 | $allPaymentMethods = Mage::helper('payment')->getPaymentMethods(); $allPaymentMethodsList = Mage::helper('payment')->getPaymentMethodList(); |
Sample Output:
1 | print_r($allPaymentMethods); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Array ( [googlecheckout] => [moneybookers_pwy] => All Polish Banks [amazonpayments_asp] => Amazon Simple Pay [banktransfer] => Bank Transfer Payment [braintree_basic] => Braintree [moneybookers_csi] => CartaSi [moneybookers_gcb] => Carte Bleue [cashondelivery] => Cash On Delivery [checkmo] => Check / Money order ... ... ) |
Sample Output:
1 | print_r($allPaymentMethodsList); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | Array ( [ccsave] => Array ( [active] => 0 [cctypes] => AE,VI,MC,DI [model] => payment/method_ccsave [order_status] => pending [title] => Credit Card (saved) [allowspecific] => 0 [group] => offline [useccv] => 0 [centinel] => 0 [min_order_total] => [max_order_total] => [sort_order] => ) [checkmo] => Array ( [active] => 0 [model] => payment/method_checkmo [order_status] => pending [title] => Check / Money order [allowspecific] => 0 [group] => offline [payable_to] => [mailing_address] => [min_order_total] => [max_order_total] => [sort_order] => ) [free] => Array ( [active] => 1 [model] => payment/method_free [order_status] => pending [title] => No Payment Information Required [allowspecific] => 0 [sort_order] => 1 [group] => offline ) [purchaseorder] => Array ( [active] => 0 [model] => payment/method_purchaseorder [order_status] => pending [title] => Purchase Order [allowspecific] => 0 [group] => offline [min_order_total] => [max_order_total] => [sort_order] => ) ... ... ) |
Get all and active payment methods
1 2 | $allPaymentMethods = Mage::getModel('payment/config')->getAllMethods(); $activePaymentMethods = Mage::getModel('payment/config')->getActiveMethods(); |
Both of the above variables have similar format of output.
Sample Output:
1 | print_r($activePaymentMethods); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | Array ( [free] => Mage_Payment_Model_Method_Free Object ( [_canAuthorize:protected] => 1 [_code:protected] => free [_formBlockType:protected] => payment/form [_infoBlockType:protected] => payment/info [_isGateway:protected] => [_canOrder:protected] => [_canCapture:protected] => [_canCapturePartial:protected] => [_canCaptureOnce:protected] => [_canRefund:protected] => [_canRefundInvoicePartial:protected] => [_canVoid:protected] => [_canUseInternal:protected] => 1 [_canUseCheckout:protected] => 1 [_canUseForMultishipping:protected] => 1 [_isInitializeNeeded:protected] => [_canFetchTransactionInfo:protected] => [_canReviewPayment:protected] => [_canCreateBillingAgreement:protected] => [_canManageRecurringProfiles:protected] => 1 [_canCancelInvoice:protected] => [_debugReplacePrivateDataKeys:protected] => Array ( ) [_data:protected] => Array ( [id] => free [store] => ) [_hasDataChanges:protected] => 1 [_origData:protected] => [_idFieldName:protected] => [_isDeleted:protected] => [_oldFieldsMap:protected] => Array ( ) [_syncFieldsMap:protected] => Array ( ) ) [cashondelivery] => Mage_Payment_Model_Method_Cashondelivery Object ( [_code:protected] => cashondelivery [_formBlockType:protected] => payment/form_cashondelivery [_infoBlockType:protected] => payment/info [_isGateway:protected] => [_canOrder:protected] => [_canAuthorize:protected] => [_canCapture:protected] => [_canCapturePartial:protected] => [_canCaptureOnce:protected] => [_canRefund:protected] => [_canRefundInvoicePartial:protected] => [_canVoid:protected] => [_canUseInternal:protected] => 1 [_canUseCheckout:protected] => 1 [_canUseForMultishipping:protected] => 1 [_isInitializeNeeded:protected] => [_canFetchTransactionInfo:protected] => [_canReviewPayment:protected] => [_canCreateBillingAgreement:protected] => [_canManageRecurringProfiles:protected] => 1 [_canCancelInvoice:protected] => [_debugReplacePrivateDataKeys:protected] => Array ( ) [_data:protected] => Array ( [id] => cashondelivery [store] => ) [_hasDataChanges:protected] => 1 [_origData:protected] => [_idFieldName:protected] => [_isDeleted:protected] => [_oldFieldsMap:protected] => Array ( ) [_syncFieldsMap:protected] => Array ( ) ) [paypal_standard] => Mage_Paypal_Model_Standard Object ( [_code:protected] => paypal_standard [_formBlockType:protected] => paypal/standard_form [_infoBlockType:protected] => paypal/payment_info [_isInitializeNeeded:protected] => 1 [_canUseInternal:protected] => [_canUseForMultishipping:protected] => [_config:protected] => [_isGateway:protected] => [_canOrder:protected] => [_canAuthorize:protected] => [_canCapture:protected] => [_canCapturePartial:protected] => [_canCaptureOnce:protected] => [_canRefund:protected] => [_canRefundInvoicePartial:protected] => [_canVoid:protected] => [_canUseCheckout:protected] => 1 [_canFetchTransactionInfo:protected] => [_canReviewPayment:protected] => [_canCreateBillingAgreement:protected] => [_canManageRecurringProfiles:protected] => 1 [_canCancelInvoice:protected] => [_debugReplacePrivateDataKeys:protected] => Array ( ) [_data:protected] => Array ( [id] => paypal_standard [store] => ) [_hasDataChanges:protected] => 1 [_origData:protected] => [_idFieldName:protected] => [_isDeleted:protected] => [_oldFieldsMap:protected] => Array ( ) [_syncFieldsMap:protected] => Array ( ) ) ) |
Get used payment methods
To get all the payment methods that have been used while placing orders, we use the following code:
1 2 3 4 5 6 | $collection = Mage::getResourceModel('sales/order_payment_collection'); $collection->getSelect()->group('method'); $usedPaymentMethods = array(); foreach ($collection as $col) { $usedPaymentMethods[] = $col->getMethod(); } |
Sample Output:
1 | print_r($usedPaymentMethods); |
1 2 3 4 5 6 7 | Array ( [0] => cashondelivery [1] => ccsave [2] => checkmo [3] => paypal_standard ) |
Hope this helps. Thanks.





Mukesh Chapagain is a graduate of Kathmandu University (Dhulikhel, Nepal) from where he holds a Masters degree in Computer Engineering. Mukesh is a passionate web developer who has keen interest in open source technologies, programming & blogging.