4

The payment action of PayPal it's set to authorization (I need it, I can't set to sale), therefore then I need to capture the payment.

I know that I can do it manually from the invoice sending page, but I need to capture the payment automatically after 6 hours from the order time.

Could you suggest how to do that cron, and the function to capture the money automatically after 6 hours?

0

The code to do it is fairly simple, you would need to create a cronjob and a datetime check.

$invoice = $order->prepareInvoice();
$invoice->register()->capture();
Mage::getModel('core/resource_transaction')
    ->addObject($invoice)
    ->addObject($invoice->getOrder())
    ->save();
  • How can I limit it only to who have paid with PayPal? – Xavier Oct 5 '16 at 15:07
  • if($order->getPayment()->getMethodInstance()->getCode() == 'paypal_express') { //do the invoice } – elfling Oct 5 '16 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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