Author Topic: PayPal not setting orders to Confirmed  (Read 2206 times)

rhyemedia

  • Beginner
  • *
  • Posts: 3
    • Rhye Media - Digital Design
  • Skype Name: drew_beard
  • VirtueMart Version: 3.6.10
PayPal not setting orders to Confirmed
« 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

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2996
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: PayPal not setting orders to Confirmed
« Reply #1 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

Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3262
  • VirtueMart Version: 3.8.4
Re: PayPal not setting orders to Confirmed
« Reply #2 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.)

regards
A

Joomla 3.9.20
php 7.3

rhyemedia

  • Beginner
  • *
  • Posts: 3
    • Rhye Media - Digital Design
  • Skype Name: drew_beard
  • VirtueMart Version: 3.6.10
Re: PayPal not setting orders to Confirmed
« Reply #3 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  :)


Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2996
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: PayPal not setting orders to Confirmed
« Reply #4 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
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3262
  • VirtueMart Version: 3.8.4
Re: PayPal not setting orders to Confirmed
« Reply #5 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
regards
A

Joomla 3.9.20
php 7.3

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 642
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: PayPal not setting orders to Confirmed
« Reply #6 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 :)
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3262
  • VirtueMart Version: 3.8.4
Re: PayPal not setting orders to Confirmed
« Reply #7 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!
regards
A

Joomla 3.9.20
php 7.3

rhyemedia

  • Beginner
  • *
  • Posts: 3
    • Rhye Media - Digital Design
  • Skype Name: drew_beard
  • VirtueMart Version: 3.6.10
Re: PayPal not setting orders to Confirmed
« Reply #8 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 :)

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2996
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: PayPal not setting orders to Confirmed
« Reply #9 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
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3262
  • VirtueMart Version: 3.8.4
Re: PayPal not setting orders to Confirmed
« Reply #10 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
regards
A

Joomla 3.9.20
php 7.3

Gingerweb

  • Jr. Member
  • **
  • Posts: 60
  • A beginner
Re: PayPal not setting orders to Confirmed
« Reply #11 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

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9777
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: PayPal not setting orders to Confirmed
« Reply #12 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?

GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Gingerweb

  • Jr. Member
  • **
  • Posts: 60
  • A beginner
Re: PayPal not setting orders to Confirmed
« Reply #13 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?

Gingerweb

  • Jr. Member
  • **
  • Posts: 60
  • A beginner
Re: PayPal not setting orders to Confirmed
« Reply #14 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".