VirtueMart Forum

VirtueMart 2 + 3 => Plugins: Payment, Shipment and others => Topic started by: rhyemedia on May 27, 2020, 03:55:26 am

Title: PayPal not setting orders to Confirmed
Post by: rhyemedia on May 27, 2020, 03:55:26 am
Hi,

I am running VM 3.6.10 10211 on Joomla! 3.9.18 and the status of new orders are no longer being automatically changed from Pending to Confirmed after a successful Paypal transaction.

The last few lines of the paypal.2.log file returns the following message:

 DEBUG validateIpnContent: valid_ipn: VERIFIED
 DEBUG payment_status: Completed
 DEBUG _status of order is restricted cannot be set to confirmed: Completed

Why is the order status being restricted and how can this be fixed?


PHP Version    7.3.18
Title: Re: PayPal not setting orders to Confirmed
Post by: Jörgen on May 27, 2020, 07:05:45 am
What has changed ? VM version ? Joomla version ? PHP version ? PayPal account settings?


What are your settings for status CONFIRMED, are you using standard letter ? Or are You using some other combination ?

Jörgen @ Kreativ Fotografi

Title: Re: PayPal not setting orders to Confirmed
Post by: AH on May 27, 2020, 09:09:19 am
This is coming from the setting that allows an order to be set to a confirmed status only if it is at a pre-defined status when the paypal response is received

e.g.
pending -> confirmed

but
shipped -> not allowed to be set back to confirmed

Look in the paypal configuration at  "Successful status restriction via IPN"

Then determine what status the order was at when a notify from paypal came through

If this is not set - a late PayPal notify came come in to your site and set any order at any status to confirmed (and yes delayed PayPal IPN notices do happen.)

Title: Re: PayPal not setting orders to Confirmed
Post by: rhyemedia on May 28, 2020, 02:10:51 am
This shop is managed by someone else and they have been updating the orders manually since December last year. I have only just been informed that there was an issue. The last automatically updated order in their system was made in November. I believe that was around the time there were bugs or issues with Paypal's IPN?

Since then VM and Joomla have both been updated to the current versions. They tell me no changes have been made to their Paypal account and their PHP version remains unchanged.

The payment method configurations are show below:
Pending transactions | Confirmed by shopper
Successful transactions | Confirmed
Successful status restriction via IPN | Confirmed
Cancel transactions | Cancelled
Capture Payment | Confirmed
Refunded transactions | Refunded
Partial Refunded transactions | Refunded
Denied | Denied

These shouldn't have been changed. Thanks so much for the prompt response  :)

Title: Re: PayPal not setting orders to Confirmed
Post by: Jörgen on May 28, 2020, 07:24:57 am
As I can see the ONLY status that can be updated through IPN is confirmed. How can You set confirmed if confirmed is the only status that allows update via IPN? I could interpretet the description for this in the back end wrong, but this is how I see it.

Remove this or choose something more appropriate.

Jörgen @ Kreativ Fotografi
Title: Re: PayPal not setting orders to Confirmed
Post by: AH on May 28, 2020, 12:32:36 pm
Maybe this will help you and others going forward:-

When an order is made and confirmed for final payment, VM stores the order and sets the status as a P.  This happens to all orders regardless of the payment method. Why? Well an order has to be saved with a status and P has been choesen (referred to as Pending - but can be thought of as a stored order, that is yet to have any payment attempted.)

(Dont get this confused with "PayPal's pending state" - that is their own naming for where the transaction has not been completed payment at PayPal. This has the configuration option in the payment settings - which you have set -> Pending transactions | Confirmed by shopper -  I have this set to Pending - but that is based on how I want to work :-) )

PayPal sends an IPN on completion of a payment attempt - this indicates the result of the payment attempt at PayPal based on the result the VM status can be configured.

In your matrix - the first value is the IPN payment result and the second value is the VM status to set based on that response result:

Pending transactions | Confirmed by shopper
Successful transactions | Confirmed
Cancel transactions | Cancelled
Capture Payment | Confirmed
Refunded transactions | Refunded
Partial Refunded transactions | Refunded
Denied | Denied

So why the -  Successful status restriction via IPN

It is possible (and has been seen by many PayPal merchants) that PayPal do not sent through IPN messages for orders (due to some unknown PayPal glitch and usually temporary).

During these "glitches" orders in VM would not have their statuses changed from Pending - Merchants will often check for a payment being made or be told by a customer that a payment has been made - so Merchants check their PayPal account see a payment has been made and decide to ship the goods - and the order status is manually changed to "fulfilled".

Then (potentially days later) the "delayed" IPN's may be sent by PayPal (which is unusual - but can occur.)

The Successful status restriction via IPN - Is there to stop an IPN changing a status of an order to the Confirmed status if it is not one of the configured statuses (it does not have to be set - but read above as to why you might want to set something)

The most simple option is to set Pending (actually a status - P)

By doing this a Confirmed status can only be set by an IPN "completed payment" message - when it is at status P

The purpose of this setting is to stop delayed IPN's setting statuses back to confirmed: for example, a Shipped status order back to a Confirmed status.

With this information - you should see what to set

If this is still a mystery, may I suggest you go with

Successful status restriction via IPN | Pending and  Confirmed by shopper
Title: Re: PayPal not setting orders to Confirmed
Post by: pinochico on May 28, 2020, 16:41:09 pm
Great,

it always surprises me how logic and logical thinking can explain that a bug is not part of VirtueMart

Thanks :)
Title: Re: PayPal not setting orders to Confirmed
Post by: AH on May 28, 2020, 18:30:48 pm
Yep and this is definitely NOT a bug.

It was a new feature created to prevent VM doing incorrect/bad things with delayed IPN messages

For example setting "shipped" statused orders back to "confirmed" when PayPal decided to start sending IPN messages through for orders you had manually worked!
Title: Re: PayPal not setting orders to Confirmed
Post by: rhyemedia on May 29, 2020, 03:39:26 am
Thanks so much for the detailed response. That information should be added to the PayPal Manual as I don't believe it currently covers the IPN set-up!

I have updated the 'status restriction via IPN' to Pending as suggested.

It is unfortunate that a 'glitch' created outside of VM can create so many issues.

Thanks so much for your help :)
Title: Re: PayPal not setting orders to Confirmed
Post by: Jörgen on May 29, 2020, 07:32:52 am
If You read the info in the configuration you will actually find how to do it. Assigning nothing, which is actually default, would not have caused this problem. Someone decided to put in Confirmed and that works actually if You make a refund via paypal. I see You have Pending transactions set as Confirmed by shopper. If You only allow PayPal to update the Pending status via IPN, You may still have a issue. In my opinion adding Confirmed by shopper would also be needed. You will of course in time see for yourself if this is neccessary.

Jörgen @ Kreativ Fotografi
Title: Re: PayPal not setting orders to Confirmed
Post by: AH on May 29, 2020, 10:47:21 am
Rhyemedia

It caused problems for many people not just VM users :-)

We now have an option to prevent late "completed payments notifications" messing up order statuses

As suggested - I have updated the documentation to explain this field


Jorgen

Thank you for clarifying what I said
 
Quote
If this is still a mystery, may I suggest you go with
Successful status restriction via IPN | Pending and  Confirmed by shopper
Title: Re: PayPal not setting orders to Confirmed
Post by: Gingerweb on June 05, 2020, 17:50:00 pm
Having read and implented the above "fix" which made no difference can you suggest anything else that might cause my new shop not to change the order status from Pending to Confirmed after a paypal transaction?
Joomla 3.9.19 and VM 3.8.2.10325
Tried using sandbox and live paypal but it stays on "pending" unless manually changed.
I am fairly certain that everything is set exactly the same as another shop that works fine

This is the log from my latest try :

Code: [Select]
2020-06-05 15:14:11 DEBUG plgVmConfirmedOrder: order number: A47I017
2020-06-05 15:14:11 MESSAGE plgVmConfirmedOrder: Amount/Currency stored 3.5 paymentcurrency 52 orderusercurrency52
2020-06-05 15:14:57 DEBUG plgVmOnPaymentResponseReceived: stdClass Object
(
    [id] => 15
    [virtuemart_order_id] => 20
    [order_number] => A47I017
    [virtuemart_paymentmethod_id] => 4
    [payment_name] => <span class="vmpayment_name">Paypal</span> <span style="color:red;font-weight:bold">Sandbox (4)</span><span class="vmpayment_description">All cards accepted no Paypal account required</span>
    [payment_order_total] => 3.50000
    [payment_currency] => 52
    [email_currency] => 52
    [cost_per_transaction] => 0.00
    [cost_percent_total] => 0.00
    [tax_id] => 0
    [paypal_custom] => 8d8f5732f2db11d7ca1a1c1437031097
    [paypal_method] => 0
    [paypal_response_mc_gross] => 0.00
    [paypal_response_mc_currency] => 0
    [paypal_response_invoice] => 0
    [paypal_response_protection_eligibility] => 0
    [paypal_response_payer_id] => 0
    [paypal_response_tax] => 0.00
    [paypal_response_payment_date] => 0
    [paypal_response_payment_status] => 0
    [paypal_response_pending_reason] => 0
    [paypal_response_mc_fee] => 0.00
    [paypal_response_payer_email] => 0
    [paypal_response_last_name] => 0
    [paypal_response_first_name] => 0
    [paypal_response_business] => 0
    [paypal_response_receiver_email] => 0
    [paypal_response_transaction_subject] => 0
    [paypal_response_residence_country] => 0
    [paypal_response_txn_id] => 0
    [paypal_response_txn_type] => 0
    [paypal_response_parent_txn_id] => 0
    [paypal_response_case_creation_date] => 0
    [paypal_response_case_id] => 0
    [paypal_response_case_type] => 0
    [paypal_response_reason_code] => 0
    [paypalresponse_raw] => 0
    [paypal_fullresponse] => 0
    [created_on] => 2020-06-05 15:14:11
    [created_by] => 0
    [modified_on] => 2020-06-05 15:14:11
    [modified_by] => 0
    [locked_on] => 0000-00-00 00:00:00
    [locked_by] => 0
)

thanks
Title: Re: PayPal not setting orders to Confirmed
Post by: GJC Web Design on June 05, 2020, 23:31:38 pm
what does the IPN log on the paypal account say?  Are the IPNs being sent and successfully received?

https://www.paypal.com/us/cgi-bin/webscr?cmd=_display-ipns-history&nav=0.3.5

Do you see the IPNs in the server traffic?

Title: Re: PayPal not setting orders to Confirmed
Post by: Gingerweb on June 05, 2020, 23:38:36 pm
what does the IPN log on the paypal account say?  Are the IPNs being sent and successfully received?

https://www.paypal.com/us/cgi-bin/webscr?cmd=_display-ipns-history&nav=0.3.5

Do you see the IPNs in the server traffic?

Yes the IPN's are being sent by Paypal there is a list of them in there, not sure what is safe to show on here or do you just need to know that they are being created? I can confirm that the response is 200 though

Not sure where to look for the server traffic?
Title: Re: PayPal not setting orders to Confirmed
Post by: Gingerweb on June 06, 2020, 09:06:49 am
Also tried reinstalling VM and VM aio and updating vm plugin tables.
All that has done is bring back the "array" error in product detail pages, still "pending".
Title: Re: PayPal not setting orders to Confirmed
Post by: Jörgen on June 06, 2020, 09:09:04 am
What are your status in paypal payment configuration to allow ipn updates ?

Jörgen @ Kreativ Fotografi
Title: Re: PayPal not setting orders to Confirmed
Post by: Gingerweb on June 06, 2020, 09:12:20 am
What are your status in paypal payment configuration to allow ipn updates ?

Jörgen @ Kreativ Fotografi

Hi thanks for having a look, see attached screenshot of the config, i have tried lots of options, sandbox and live
Title: Re: PayPal not setting orders to Confirmed
Post by: GJC Web Design on June 06, 2020, 10:01:10 am
Quote
I can confirm that the response is 200 though

then this confirms all OK from the paypal end and the reception of the IPN

is the IPN response logged in the  #_virtuemart_payment_plg_paypal table?

Personally I wouldn't use the sandbox  .. just make a 1p product with free shipping as a test
Title: Re: PayPal not setting orders to Confirmed
Post by: Gingerweb on June 06, 2020, 14:56:56 pm
Quote
I can confirm that the response is 200 though

then this confirms all OK from the paypal end and the reception of the IPN

is the IPN response logged in the  #_virtuemart_payment_plg_paypal table?

Personally I wouldn't use the sandbox  .. just make a 1p product with free shipping as a test

Thanks - yes i have done exactly that and there is an entry in that table referencing this 1p sale (it is still "pending")
Title: Re: PayPal not setting orders to Confirmed
Post by: Jörgen on June 06, 2020, 21:31:35 pm
If You look at order datails is there only ONE DateAdded/ShopperNotified/OrderStatus/Comment entry for each order ?
And this entry sais Pending ?
You should have two entries for a PayPal purchase, Pending and Confirmed.

Turn on PayPal debug and debug to file.

Jörgen @ Kreativ Fotografi
Title: Re: PayPal not setting orders to Confirmed
Post by: Gingerweb on June 06, 2020, 23:10:53 pm
If You look at order datails is there only ONE DateAdded/ShopperNotified/OrderStatus/Comment entry for each order ?
And this entry sais Pending ?
You should have two entries for a PayPal purchase, Pending and Confirmed.

Is this in Orders? There appears to be only one entry for each test order and everything says "pending"

Turn on PayPal debug and debug to file.

Code: [Select]
PayPal request::
Array
(
        [cmd]   ⇒   _ext-enter
        [redirect_cmd]   ⇒   _xclick
        [paymentaction]   ⇒   sale
        [upload]   ⇒   1
        [business]   ⇒   shopemail@domain.co.uk
        [receiver_email]   ⇒   shopemail@domain.co.uk
        [order_number]   ⇒   6DN3021
        [invoice]   ⇒   6DN3021
        [custom]   ⇒   e6c1efc39293032a880513d6823ed60b
        [currency_code]   ⇒   GBP
        [address_override]   ⇒   0
        [first_name]   ⇒   test
        [last_name]   ⇒   test
        [address1]   ⇒   test
        [address2]   ⇒ 
        [zip]   ⇒   test
        [city]   ⇒   test
        [state]   ⇒   EN
        [country]   ⇒   GB
        [email]   ⇒   email@myemail.co.uk
        [night_phone_b]   ⇒   test
        [return]   ⇒   https://foam-o.co.uk/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=6DN3021&pm=4&Itemid=567
        [notify_url]   ⇒   https://foam-o.co.uk/index.php?option=com_virtuemart&view=vmplg&task=notify&tmpl=component&lang=
        [cancel_return]   ⇒   https://foam-o.co.uk/index.php?option=com_virtuemart&view=vmplg&task=pluginUserPaymentCancel&on=6DN3021&pm=4&Itemid=567&lang=
        [rm]   ⇒   2
        [bn]   ⇒   VirtueMart_Cart_PPA
        [no_shipping]   ⇒   0
        [no_note]   ⇒   1
        [image_url]   ⇒   https://foam-o.co.uk/images/stories/virtuemart/vendor/paypal-smaller-logo-foam-o.jpg
        [item_name]   ⇒   Order   Number:   6DN3021
        [amount]   ⇒   0.01
)

url that brought me back to the shop after Paypal payment accepted is :

https://foam-o.co.uk/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=6DN3021&pm=4&Itemid=567

Order is "pending"  :(

Hope this shows you something useful!!
cheers
Title: Re: PayPal not setting orders to Confirmed
Post by: GJC Web Design on June 07, 2020, 11:07:23 am
Quote
https://foam-o.co.uk/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=6DN3021&pm=4&Itemid=567

just brings up some weird "sitelock" thing.. if I can't reach the site then neither can paypal

Title: Re: PayPal not setting orders to Confirmed
Post by: Gingerweb on June 07, 2020, 11:45:27 am

just brings up some weird "sitelock" thing.. if I can't reach the site then neither can paypal

FFS im so sorry of course, usually i build these on temp sites where it can be unlocked, this one is a live domain that is locked, i turned it off to test it and it works perfectly!
Thanks John for pointing out my stupidity!
Title: Re: PayPal not setting orders to Confirmed
Post by: kvo on July 03, 2020, 15:36:56 pm
I have the same response as Gingerweb.
It may have started after the latest update. I updated to Joomla 3.9.19, VM 3.8.4
I also have another shop, using the same settings that was not affected.
I have tried quiet a few fixes, but no change. Still get Pending as the order status.
Title: Re: PayPal not setting orders to Confirmed
Post by: GJC Web Design on July 03, 2020, 15:56:58 pm
all the information and tests that you need to do are in this thread..  do them and write back here the results...
Because the system works unless there is a problem or misconfiguration of your site .. something, with the information you give, we can do nothing to help...
Title: Re: PayPal not setting orders to Confirmed
Post by: kvo on July 03, 2020, 16:16:48 pm
I turned on debugs and after placing the order, BEFORE I get to Paypal, the debug shows as below. But the refresh icon keeps spinning and the button that says"The method is in debug mode. Click here to be redirected to PayPal" is not able to be clicked as the page continues to refresh.
Title: Re: PayPal not setting orders to Confirmed
Post by: GJC Web Design on July 03, 2020, 16:59:09 pm
then switch the debug off and just examine the logging
Title: Re: PayPal not setting orders to Confirmed
Post by: kvo on July 03, 2020, 18:14:56 pm
ok thanks, There is nothing in the paypal_response_invoice or paypal_full_response fields...
Title: Re: PayPal not setting orders to Confirmed
Post by: GJC Web Design on July 03, 2020, 18:48:58 pm
have u read this post?  your paypal IPN history etc? your IPN response url tested?
Title: Re: PayPal not setting orders to Confirmed
Post by: kvo on July 23, 2020, 15:34:46 pm
Yes, I've been through everything I can think of.  The IPN history shows all since a month ago status as "Retrying".  My IPN HTTP Response Codes for these failed attempts are 403.
Title: Re: PayPal not setting orders to Confirmed
Post by: kvo on July 23, 2020, 15:39:59 pm
I might also note that when using the IPN simulator to test,  when using Web Accept as the Transaction Type, IPN was sent and the handshake was verified.
But using Cart Checkout as the Transaction Type, IPN was not sent, and the handshake was not verified. Review your information.
Title: Re: PayPal not setting orders to Confirmed
Post by: AH on July 23, 2020, 17:11:02 pm
Sadly you are the only person have this issue.

You may need to seek professional paid assistance