We have this issue appear occasionally
Having placed debug trace on the paypal cancel action, I got the following information:
which clearly shows the cancel action was called via the Mage_Paypal_StandardController
so, this is an external call, to cancel the order.
Locating the actual webserver logs, I can then see the call did indeed come from external (paypal)
The interesting bit there is that it was a 302 (redirect)
If I load that referrer URL, I get a paypal display that the session has timed out.
Also, I could determine this was from an iPad.
I don't have enough of these to determine other devices, so that could mean squat.
So, given from what I see, I am making a calculated assumption that this cancel action is initiated from paypal, when/if teh user session on teh paypal side has times out, or had issues keeping session during the transaction period.
Paypal then actions a cancel request ?
UPDATE: Setting the trace:
As per comments request, here is how I placed the trace.
When the order is cancelled, a comment is placed in the order history/comments concerning that cancellation.
This is where I injected my trace code, thus tracing back the code path to having reached that comment insertion.
It can just as well be pushed to a log file.
I created a small module for this:
I simply did a rewrite of the core sales order module (be aware of creating a rewrite conflict if some other 3rd party module also rewrites this class. In my case this was not an issue:
In module config.xml
<global>
<models>
<enjo_sales>
<class>Enjo_Sales_Model</class>
</enjo_sales>
<sales>
<rewrite>
<order>Enjo_Sales_Model_Order</order>
</rewrite>
</sales>
</models>
</global>
and then in the model class:
<?php
class Enjo_Sales_Model_Order extends Mage_Sales_Model_Order
{
protected function _setState($state, $status = false, $comment = '',
$isCustomerNotified = null, $shouldProtectState = false)
{
if ($this->getState() != $state && $state == self::STATE_CANCELED) {
$comment .= Varien_Debug::backtrace(true,true, true);
}
return parent::_setState($state, $status, $comment, $isCustomerNotified, $shouldProtectState);
}
}
Best Answer
To create an order and then ask the customer to pay for it is not possible without creating a custom payment method along with the workflow that would enable the customer to login, select there order, and enter there credit card info.
However by default magento allow you to create a quote in the admin (not an order) and move it to the customer cart.