Where do I find the valid parameter for setPaymentMethod()?

$quote = Mage::getModel('sales/quote');

setPaymentMethod('checkmo') did work find but I disabled this option and replaced it with the adyen module. Where do I find the correct parameter now?

I tried adyen_hpp because of

class Madia_Adyen_Model_Adyen_Hpp extends Madia_Adyen_Model_Adyen_Abstract {

    protected $_code = 'adyen_hpp';

Also there is a config.xml that might be involved?

            <customer_id backend_model="adminhtml/system_config_backend_encrypted"/>
            <title>Adyen HPP</title>
  • What type is the object you called setPaymentMethod on?
    – Marius
    Sep 16, 2013 at 13:40
  • @Marius on sales/quote I added object creation. I am generation an order based on this. Sep 16, 2013 at 13:45

2 Answers 2


Based on what I found int Mage_Checkout_Model_Type_Onepage::savePayment:

    if ($quote->isVirtual()) {
        $quote->getBillingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null);
    } else {
        $quote->getShippingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null);

I can conclude that the setPaymentMethod call should be made to an address object (shipping or billing if the order is virtual). The value of the parameter should be the payment method code (just like you suspected). Maybe it doesn't work because you are calling it directly on the quote.

Edit by OP

The above is correct and actually I was calling setPaymentMethod() at $quote->getShippingAddress() just missed it:


Problem was that I needed to change payment method here to:

 $quote->getPayment()->importData( array('method' => 'adyen_hpp'));

Now it's still not working because of a new error but that is another problem.


Generally the setPaymentMethod() depends on the address object of shipping or billing method.

As you are using directly quote object is wrong method. First of all, get the Shipping Address by using quote and assign it to the address object.

$session = Mage::getSingleton('checkout/session');
$quote = $session->getQuote();
$address = $quote->getShippingAddress();

Hope this will help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.