Jump to content

Issue with creating an intermediate pending order


Recommended Posts

I have created a custom payment module.

Currently it calls validateOrder() after the redirection from the payment website, and this method creates the order, sends email etc. But the issue is if user closed the payment website before it can redirect back to the PrestaShop website the order won't be created in this case. So, I want to create an order(say with "pending" status) before I redirect to the payment website and after redirection from the payment website I can simply mark the same payment as done and send mails etc.

Currently for this I was trying to call validateOrder twice, once in hookdisplayPayment(here I set the status as "pending) and once after redirection. But now after redirection I am getting "The cart cannot be loaded, or an order has already been placed using this cart". I think that's because I can't update the same order twice using the same Card Id.

Note that I want to send the emails only once, once the payment is successful. Currently for this I am using a custom payment status with 'send_email' set to 0.
 

What's a good workaround for this? 

I would like to support versions 1.5+, 1.6+ if that matters.

Link to comment
Share on other sites

  • 3 weeks later...
×
×
  • Create New...