I'm trying to create order programmatically by following code but getting payment not available.

$customer = Mage::getModel('customer/customer')->load($data->user);
$quote =Mage::getSingleton('checkout/session')->getQuote(); 
// Assign Customer To Sales Order Quote

// Collect Rates and Set Shipping & Payment Method
$quote->getPayment()->importData(array('method' => 'checkmo'));
try {
    // Collect Totals & Save Quote
    // Create Order From Quote
    $service = Mage::getModel('sales/service_quote', $quote);
    $increment_id = $service->getOrder()->getRealOrderId();
catch (Exception $ex) {
    echo $ex->getMessage();
catch (Mage_Core_Exception $e) {
    echo $e->getMessage();
$quote = $customer = $service = null;
// Finished
echo  $increment_id;
  • Did you enable cheque or money order payment method in admin panel ? Commented Jul 18, 2017 at 6:16
  • yes it is enabled , i'm creating these orders by custom extension ,normal order works fine
    – HARI
    Commented Jul 18, 2017 at 6:19
  • check all condition is satisfied or not ( Payment from Specific Countries , Minimum Order Total ) for Check / Money order Commented Jul 18, 2017 at 6:34

1 Answer 1


It's difficult to track without the full quote information & your store configuration, but have a look at the source of the error, from app/code/core/Mage/Sales/Model/Quote/Payment.php's importData function:


if (!$method->isAvailable($this->getQuote())
    || !$method->isApplicableToQuote($this->getQuote(), $data->getChecks())
) {
    Mage::throwException(Mage::helper('sales')->__('The requested Payment Method is not available.'));

There are two reasons you may be getting this error, either:

  1. The method is not available, or,
  2. The method is not applicable to the quote

Firstly, check that the method for Cheque / Money Order is enabled in SystemConfigurationSalesPayment Methods

Secondly, check that your quotation is satisfying the requirements of the payment method (minimum order total, maximum order total, allowed countries etc.)

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.