PayPal Canceled Orders looks like completed orders.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
Steps to reproduce the problem:

1. Add Product to Cart and CheckOut to Pay with PayPal
2. Changed my mind and Cancel The order
3. Returned from Paypal to my Site: Order# is generated and it looks like Order has been processed. However, I did not pay. I received an Email thanking me for the Order and the Store Admin also received a completed Order that is ready to be fulfilled. On the Admin Side of nopCommerce, there is an Order listed as Pending.

So, Essentially, even though I canceled the order and did not Pay, it is still listed as being made.

I think Cancelled Orders should just return to the page and no emails should be sent to anyone. An entry in the Admin side should be recorded as Cancelled so we can contact the Client if we wanted to, however, in case the client decides later to update her order and pay for it, then, the Cancelled order entry in Admin should be removed.

Right now, it is confusing to both the Client and Store.  PayPal canceled orders looks like paid orders to both client and store, unless one looks at the Admin page, you would never know if the order was not paid due to Pending status.
5 years ago
Is the Order's payment status Paid or Pending?
I've seen PayPal "failures" leave payment status Pending, and an "Order Placed" (not Paid) email goes out (so I've disabled that template).

If you see status Paid, then check the Order Notes, to see what is in the transaction.  (How does it compare to one that is successful?)
5 years ago
The Order is marked as "Pending" and Emails to Store and Client announcing Order Placed after I reached PayPal and click on the Cance link.  

I think the App should behave like Woocommerce in this situation, i.e., if the order is canceled at the PayPal screen, then return the Client to the Cart and do nothing.  A canceled order noticed may be posted to the Admin Order area so Store admins can contact the Customer and provide assistance, but that is all.

Is that something we can code into the App?
5 years ago
@New York,

Would mind letting me know which template you deactivated to eliminate the Order has been made message when an Order is canceled at the PayPal screen?
5 years ago
webzest wrote:
which template you deactivated to eliminate the Order has been made message when an Order is canceled at the PayPal screen?

The email you ask about is queued and potentially sent when the order is created and before the payment is tried to be made. The template is called OrderPlaced.CustomerNotification.

This is the way the system works - the order is created first, the email is sent, then a payment is tried and outcome applied to the order.

This is because the system needs to apply the payment to an order number (or at least some sort of record id) when the payment is made. If you did not create the order first then there could exist a case where the cart contents are sent for payment and something happens after the payment is made correctly, for some reason the acknowledgement is not sent back to the website, Then you have a payment made with no order, maybe no cart contents if the browser has an issue.

You could do what you have suggested and delete the order where the payment process is cancelled by the customer but you would need to modify the payment method.  Just as when the order is set to paid status when the payment is made. You could choose to delete the order when the payment is cancelled.

Which nopCommerce version are you using - which PayPal payment method are you using ?
5 years ago
@Yidna,

I am using the default PayPal plugin: Payments.PayPalStandard
The latest version of nopCommerce is my current installation: 4.1

Thank you for your recommendations and guidance.
5 years ago
@Yidna,

I am using the default PayPal plugin: Payments.PayPalStandard
The latest version of nopCommerce is my current installation: 4.1

I think the email messages are misleading and can be improved.  For example, When I canceled the Order at the PayPal screen before I pay for the order, I received the following email:


My Business Admin who is assigned to process the orders receive the following Email:


The Web Site returned page from the canceled action on PayPal looks like this:


I think the messages can be better crafted to reflect the actual event, such as a canceled order.
Would you mind pointing me to the proper code section to adjust these email messages?


Thank you for your recommendations and guidance.

Johnny
5 years ago
There is one the one template for when an order is placed.
Unless you are going to customise the solution. You need to manually cancel the order after it fails.

The only thing you can do as suggested by New York is to turn off the Order placed email.
OrderPlaced.CustomerNotification

Then they will only get an email when the order is paid i.e. OrderPaid.CustomerNotification
Or when you manually cancel the order the customer will get the OrderCancelled.CustomerNotification

These templates can be edited from yourwebsite.com/Admin/Topic/List

To customise the solution you need to edit the file
PaymentPayPalStandardController.cs
and the routine
         public IActionResult PDTHandler()

Have a look how it sets the Paid Status


                    //mark order as paid
                    if (newPaymentStatus == PaymentStatus.Paid)
                    {
                        if (_orderProcessingService.CanMarkOrderAsPaid(order))
                        {
                            order.AuthorizationTransactionId = txn_id;
                            _orderService.UpdateOrder(order);

                            _orderProcessingService.MarkOrderAsPaid(order);
                        }
                    }

You need to check the error code and do something like

                        if (_orderProcessingService.CanCancelOrder(order))
                        {
                            order.AuthorizationTransactionId = txn_id;
                            _orderService.UpdateOrder(order);

                            _orderProcessingService.CancelOrder(order);
                        }
5 years ago
@Yidna,



After this entry, which message will be sent to the User?
5 years ago
@Yidna,



After this entry, I tried to debug the code, but can't get the debugger to hit that breakpoint.  When I canceled from PayPal, no behavior changes took place.
I also noticed a DLL under the Nop.Web PayPal Plugin, I am not sure if the original plugin code has been compiled into a DLL and unable to be updated for debugging; I am not sure how to fix or modify the code at this point unless I deactivate those OrderPlaced Messages...
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.