Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7417599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:43:51+00:00 2026-05-29T07:43:51+00:00

Is there any functionality in magento payment extention to stop the creation of an

  • 0

Is there any functionality in magento payment extention to stop the creation of an order before the success status from payment gateway is returned?

The Extension is designed as a payment redirect (with getOrderPlaceRedirectUrl) but really in the correct controller action, I do post from the action with params, to the gateway and return success if all OK, and return failure if not.

But the order is already created so I must cancel this order, but it should not create this order in the first place.

Maybe if I can design it as a gateway, I can use some payment method to do this?

I thought about the validate or prepareSave methods, but both of them are called twice – on accept payment method and on place order.

Also I thought about events – maybe I can use some event to do this post action and on failture just throw exception?

But I really think that in the payment methods, there has to be some standard functionality that I can use.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:43:52+00:00Added an answer on May 29, 2026 at 7:43 am

    How about extending the _validate() method on Mage_Sales_Model_Service_Quote, and throw an error there so that it never gets to the “$transaction->save();” bit.

    public function submitOrder()
        {
            $this->_deleteNominalItems();
            // do some check here
            $this->_validate();
            // End checks
            $quote = $this->_quote;
            $isVirtual = $quote->isVirtual();
    
            ........
    
            try {
                $transaction->save();
                $this->_inactivateQuote();
                Mage::dispatchEvent('sales_model_service_quote_submit_success', array('order'=>$order, 'quote'=>$quote));
            } catch (Exception $e) {
                ...........
            }
            ...........
            return $order;
        }
    

    Validate function looks like this:

    protected function _validate()
    {
        $helper = Mage::helper('sales');
        if (!$this->getQuote()->isVirtual()) {
            $address = $this->getQuote()->getShippingAddress();
            $addressValidation = $address->validate();
            if ($addressValidation !== true) {
                Mage::throwException(
                    $helper->__('Please check shipping address information. %s', implode(' ', $addressValidation))
                );
            }
            $method= $address->getShippingMethod();
            $rate  = $address->getShippingRateByCode($method);
            if (!$this->getQuote()->isVirtual() && (!$method || !$rate)) {
                Mage::throwException($helper->__('Please specify a shipping method.'));
            }
        }
    
        $addressValidation = $this->getQuote()->getBillingAddress()->validate();
        if ($addressValidation !== true) {
            Mage::throwException(
                $helper->__('Please check billing address information. %s', implode(' ', $addressValidation))
            );
        }
    
        if (!($this->getQuote()->getPayment()->getMethod())) {
            Mage::throwException($helper->__('Please select a valid payment method.'));
        }
    
        return $this;
    }
    

    The extended function can look like this:

        public function __construct(Mage_Sales_Model_Quote $quote)
        {
            $this->_quote = $quote;
            parent::__construct($quote);
        }
    
    protected function _validate()
        {
            // Code to test comes here
            Mage::throwException(Mage::helper('payment')->__('unsuccessfull.....'));
            // Code ends, now call parent
    
            return parent::_validate();        
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any built in functionality that enables downloading files from FTP in .NET?
Are there any existing add-ons which would provide the functionality Upload image from local
Is there any functionality in Java for pausing the program like system(PAUSE); does in
Is there any default functionality for arranging JInternalFrames in Java Swing? I would like
Are there any differences in functionality between these two JavaScript module patterns? var MODULE
Are there any PHP libraries that provide similar functionality to Kenneth Reitz's clint library
Is there any utility or plugin which provides cscope like functionality for C++. I
Is there any tool in CherryPy that provides equivalent/similar functionality as Django's Message Framework?
I would like to ask is there any way to achieve this functionality: I
Is there a way to achieve Backspace functionality in HTML? Do we have any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.