Empty cart before payment... (v1.9)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
I have come accross an issue which I guess must be by design, but I'm not sure why...

I place a product in my shopping cart, go through checkout and prior to paying, my shopping cart is emptied.

As the last button is pressed to go to the payment gateway, the code underneath removes all the items from the cart collection.  Now if the payment fails, the shopping cart is empty and the customer has no way of paying or even knowing what was in their basket.

This seems to be core nopCommerce functionality...

Libraries\Nop.BusinessLogic\Orders\OrderService.cs (Line 2913)

This runs before the payment gateway...

Has anyone found a way to resolve this issue if payment fails?

Thanks D.
12 years ago
You're right. This is by design.
The reason is that an order must be in the database before you can start most of the payments. To most payments you need to pass the orderID or another unique value.

What you can do, in the return page for your payment method, is to check if payment succeeded. If not, then cancel the current order and fill the cart again with all products (and options) of the originating order.
12 years ago
Ahh, OK... Thanks.

Does this mean that some payment providers deal with this nicely and others don't?

Do you think it would make more sense to empty the cart on PaymentSucceeded? (I guess there are some potential duplicate order issues here though)

I am using an off site, external payment gateway, due to the 3D-Secure issue here in Europe which nop payment providers dont cater for, which makes fixing things like this a little more difficult or impossible in some cases.

To get this water tight, you would have to also deal with customers closing the off site payment gateway and returning to the site.

D.
12 years ago
There are several ways to create a standard here, but for now nop choose to do it like it works today.

It would be possible to leave products in the cart until the definitive status comes back from the payment site/service. So set the order to Cancelled or Paid according to the response.
But you have a thing there about the customers that close the payment dialog before returning to nop.

In Netherlands we have iDeal which requires a fetch (initiated by your website) on transactions that were not checked for their status. If ALL payment providers would have such a requirement, it would be easier to implement another way of handling orders/payments, because then you would have a definitive transaction result within 10 minutes after placing the order.

Another solution that can work is to add source code that adds a link to the email that is sent on Cancellation of an order. With that link customers can 're-populate' the shopping cart with the products of the initial order. They can start checking out again immediately.
12 years ago
Thanks linkXperts,

I'll try and create a mod for this and post back here if I get anywhere.

D.

(ps - do you know a payment provider that I could use, using Direct payment to keep everything 'in-house' which also handles 3D-Secure? Then I could get rid of the off site payment method...)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.