3

how can i get list of payment methods with detail like code,title,method and? is it possible get available payment method in store with API ? i need list of all available payment method in magento store.

mahdi
  • 16,257
  • 15
  • 52
  • 73

4 Answers4

9

Here You can get all available payment methods in Magento

If for any reason you need to a get a list with all payment methods in Magento, you can do it easily by using the payment config class (app/code/core/Mage/Payment/Model/Config.php).

To get a list with all payments active and inactive:

  • $allAvailablePaymentMethods = Mage::getModel('payment/config')->getAllMethods();

To get a list with all active payment methods:

  • $allActivePaymentMethods = Mage::getModel('payment/config')->getActiveMethods();

To get a list with all credit cards that Magento supports:

  • $allCcTypes = Mage::getModel('payment/config')->getCcTypes();
Amaresh Tiwari
  • 947
  • 13
  • 36
4

get active payment methods

$payments = Mage::getSingleton('payment/config')->getActiveMethods();
$methods = array(array('value'=>'','label'=>Mage::helper('adminhtml')->__('–Please Select–')));

foreach ($payments as $paymentCode=>$paymentModel) {
    $paymentTitle = Mage::getStoreConfig('payment/'.$paymentCode.'/title');
    $methods[$paymentCode] = array(
        'label'   => $paymentTitle,
        'value' => $paymentCode,
    );
}
return $methods;
paradoxos
  • 3
  • 3
Ansyori
  • 2,807
  • 3
  • 29
  • 37
2

yes you can get payment method using api. here is your solution

$client = new SoapClient('http://magentohost/api/soap/?wsdl');

// If somestuff requires api authentification,
// then get a session token
$session = $client->login('apiUser', 'apiKey');

$result = $client->call($session, 'cart_payment.list', 'quoteId');
var_dump($result);
Lokesh Jain
  • 579
  • 6
  • 19
0

You can use also this helper:

$methods = Mage::helper('payment)->getStoreMethods($store = null, $quote = null)

So you can check for a single store and for a quote if you need.