• Resolved fabiano1987

    (@fabiano1987)


    Hi i’ve a problem with WPadverts and PayPal addon plugin

    As i know, the paid ads are automatically approved when the payment is accepted..
    but this is not working for me anymore.

    when an user select a plane, and then he pays using paypal, i receive the paypal notification and i receive the payment… but the user sees that message:

    “thanks your payment has been submitted.
    Payment still in pending. If you will not receive confirmation soon, please contact our support”

    1) Why this happens? the payment through paypal is automatic, i really receive that money so why the plugin cannot verify that, and automatically approve and display the ad?

    If i go to All Classifieds i will see the new ad with “Pending Payment”. so it looks like the verification process fails

    2) In addition to that, the “ad expire data” is not updated. I see 4 days, which is the number of days i’ve setted for default but is not right number of days it should be for the amount that has been payed. Maybe this is related to the first problem

    • This topic was modified 5 years, 6 months ago by fabiano1987.
Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter fabiano1987

    (@fabiano1987)

    maybe i’ve understand the problem but i don’t know how to solve it

    i’ve received this email:


    Verify the server that manages the PayPal instant Notifications (IPN). The IPN sent to this URL are not valid:

    https://www.ispazio.net/wp-admin/admin-ajax.php?action=adext_paypal_standard_notify&payment_id=1944980

    If you don’t recognize this URL, probably your service provider is using the IPN at your name. Contact the service provider and refer these informations. If the problem persists, is possible that the IPN has been deactivated.

    so.. the problem is that paypal is sending the notification of a good payment to an url which is wrong. Right?
    How can i fix it and have WPadverts to receive these notifications and proceed automatically?

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    the IPN URL from your last message seems ok (or at least it is formatted as expected), however when accessing the link there is an error message, so my guess is that there is some kind of fatal error when trying to process the transaction.

    It would be best to ask your hosting tech support for a PHP error_log file there should be some additional details regarding the problem (at the end of the file) which will help troubleshooting, if you could not find it you can email the file to me i will take a look at it.

    Thread Starter fabiano1987

    (@fabiano1987)

    ok perfect
    from the log:

    [12-May-2019 16:22:00 UTC] PHP Warning: session_start(): Cannot start session when headers already sent in /srv/www/ispazio/wp-content/plugins/unyson/framework/includes/hooks.php on line 228

    so looks a plugin conflict/problem.. but this plugin is part (essential) for my theme.. so we need to check it out.
    i’ve opened that hooks.php and at that line i see this:

    
    // FW_Flash_Messages hooks
    {
    	if ( is_admin() ) {
    		/**
    		 * Start the session before the content is sent to prevent the "headers already sent" warning
    		 * @internal
    		 */
    		function _action_fw_flash_message_backend_prepare() {
    			if ( apply_filters( 'fw_use_sessions', true ) && ! session_id()  ) {
    				session_start();
    			}
    		}
    
    		add_action( 'current_screen', '_action_fw_flash_message_backend_prepare', 9999 );
    
    		/**
    		 * Display flash messages in backend as notices
    		 */
    		add_action( 'admin_notices', array( 'FW_Flash_Messages', '_print_backend' ) );
    	} else {
    		/**
    		 * Start the session before the content is sent to prevent the "headers already sent" warning
    		 * @internal
    		 */
    		function _action_fw_flash_message_frontend_prepare() {
    			if (
    			    apply_filters( 'fw_use_sessions', true )
                    &&
    				/**
    				 * In ajax it's not possible to call flash message after headers were sent,
    				 * so there will be no "headers already sent" warning.
    				 * Also in the Backups extension, are made many internal ajax request,
    				 * each creating a new independent request that don't remember/use session cookie from previous request,
    				 * thus on server side are created many (not used) new sessions.
    				 */
    				! ( defined( 'DOING_AJAX' ) && DOING_AJAX )
    				&&
    				! session_id()
    			) {
    				session_start();
    			}
    		}
    
    		add_action( 'send_headers', '_action_fw_flash_message_frontend_prepare', 9999 );
    
    		/**
    		 * Print flash messages in frontend if this has not been done from theme
    		 */
    		function _action_fw_flash_message_frontend_print() {
    			if ( FW_Flash_Messages::_frontend_printed() ) {
    				return;
    			}
    
    			if ( ! FW_Flash_Messages::_print_frontend() ) {
    				return;
    			}
    
    			?>
    			<script type="text/javascript">
    				(function () {
    					if (typeof jQuery === "undefined") {
    						return;
    					}
    
    					jQuery(function ($) {
    						var $container;
    
    						// Try to find the content element
    						{
    							var selector, selectors = [
    								'#main #content',
    								'#content #main',
    								'#main',
    								'#content',
    								'#content-container',
    								'#container',
    								'.container:first'
    							];
    
    							while (selector = selectors.shift()) {
    								$container = $(selector);
    
    								if ($container.length) {
    									break;
    								}
    							}
    						}
    
    						if (!$container.length) {
    							// Try to find main page H1 container
    							$container = $('h1:first').parent();
    						}
    
    						if (!$container.length) {
    							// If nothing found, just add to body
    							$container = $(document.body);
    						}
    
    						$(".fw-flash-messages").prependTo($container);
    					});
    				})();
    			</script>
    			<style type="text/css">
    				.fw-flash-messages .fw-flash-type-error {
    					color: #f00;
    				}
    
    				.fw-flash-messages .fw-flash-type-warning {
    					color: #f70;
    				}
    
    				.fw-flash-messages .fw-flash-type-success {
    					color: #070;
    				}
    
    				.fw-flash-messages .fw-flash-type-info {
    					color: #07f;
    				}
    			</style>
    			<?php
    		}
    
    		add_action( 'wp_footer', '_action_fw_flash_message_frontend_print', 9999 );
    	}
    }
    • This reply was modified 5 years, 6 months ago by fabiano1987.
    Thread Starter fabiano1987

    (@fabiano1987)

    ok perfect
    from the log:

    [12-May-2019 16:22:00 UTC] PHP Warning: session_start(): Cannot start session when headers already sent in /srv/www/ispazio/wp-content/plugins/unyson/framework/includes/hooks.php on line 228

    so looks a plugin conflict/problem.. but this plugin is part (essential) for my theme.. so we need to check it out.
    i’ve opened that hooks.php and at that line i see this:

    https://www.ispazio.net/wp-content/uploads/2019/05/Schermata-2019-05-13-alle-13.49.24.png

    Plugin Author Greg Winiarski

    (@gwin)

    The message from the error log is a warning only it would not prevent PayPal extension from validating the payment.

    One other thing you can check is to go to wp-admin / Classifieds / Payments History panel edit a payment which was paid, scroll to the bottom and see if there are any messages logged there, if so then they would be helpful when troubleshooting.

    Thread Starter fabiano1987

    (@fabiano1987)

    i’ve edited a payment from “waiting” to “completed” and in the log i only see “you have edited the status to completed”.. nothing more

    the fact is that the system was working fine in past.. In fact if i try to edit an automatically completed payment, in the log i see “2019-03-04 20:06:11 – Payment successfully verified.”

    means that in past it was working good

    i don’t know what to do.. you said that the notification URL is correct
    (https://www.ispazio.net/wp-admin/admin-ajax.php?action=adext_paypal_standard_notify&payment_id=1944980)

    it’s normal that wp-admin is included in the url ? i mean, an user can see/act on it ?

    what can i do? it’s really important to have it working

    Plugin Author Greg Winiarski

    (@gwin)

    1. changing the status manually will always add an entry to the payment log, but if the payment log is empty and payment status is “waiting” then it means that even if the PayPal sent the notification to this URL it was never processed as most likely there was some error earlier.

    If you installed some plugins recently you can try disabling them and see if it helps, maybe they are conflicting with the PayPal plugin.

    2. the URL is correct it should contain the /wp-admin/admin-ajax.php

    3. i allowed myself to test your URL with PayPal IPN simulator https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNSimulator/# and there is following error “IPN was not sent, and the handshake was not verified.”

    It seems this happens when the server is non-compliant with the PayPal SSL encryption. More about it you can find here https://stackoverflow.com/questions/32586711/ipn-was-not-sent-and-the-handshake-was-not-verified-please-review-your-informa. You would need to ask your server tech support to verify the issue for you.

    The techsupport can also check if a request was sent to page https://www.ispazio.net/wp-admin/admin-ajax.php?action=adext_paypal_standard_notify&payment_id=1944980 from PayPal and what status it returned.

    4. if none of this will help you can send me a message via contact form here https://wpadverts.com/contact/ i will send you some additional debug code which might help with troubleshooting.

    Thread Starter fabiano1987

    (@fabiano1987)

    Request resulted in an 500 Error:

    173.0.81.33 – – [15/May/2019:09:19:03 +0200] “POST /wp-admin/admin-ajax.php?action=adext_paypal_standard_notify&payment_id=1944980 HTTP/1.1” 500 3878 “-” “Needle/1.6.0 (Node.js v8.12.0; linux x64)”

    Excerpt from PHP Log for this request:

    [15-May-2019 07:19:05 UTC] PHP Fatal error: Uncaught Exception: PayPal sent INVALID response. in /srv/www/ispazio/wp-content/plugins/wpadverts-paypal-standard/wpadverts-paypal-standard.php:424
    Stack trace:
    #0 /srv/www/ispazio/wp-includes/class-wp-hook.php(286): adext_paypal_standard_notify(”)
    #1 /srv/www/ispazio/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(”, Array)
    #2 /srv/www/ispazio/wp-includes/plugin.php(465): WP_Hook->do_action(Array)
    #3 /srv/www/ispazio/wp-admin/admin-ajax.php(188): do_action(‘wp_ajax_nopriv_…’)
    #4 {main}
    thrown in /srv/www/ispazio/wp-content/plugins/wpadverts-paypal-standard/wpadverts-paypal-standard.php on line 424

    Plugin Author Greg Winiarski

    (@gwin)

    Thanks that should be it, the PayPal returns “INVALID” response when trying to authenticate the request sent from PayPal.

    You can try fixing it by opening the wpadverts-paypal-standard/wpadverts-paypal-standard.php file and on line 397 replace $value = urlencode($value); with $value = urlencode(stripslashes($value));

    If this will not help then on line 426 before

    
    throw new Exception("PayPal sent INVALID response.", 2);
    

    you can add these two lines

    
    adext_payments_log($payment_id, var_export($_POST, true) );
    adext_payments_log($payment_id, $res );
    

    These lines will log in wp-admin / Classifieds / Payments History panel when editing the payment: data sent by PayPal and the actual response received when trying to validate the response.

    Thread Starter fabiano1987

    (@fabiano1987)

    ok i tried the first thing about paypal-standard.php file and the line 397

    but it was still not working

    so i did the second thing about the line 426

    what i have to do next?

    Plugin Author Greg Winiarski

    (@gwin)

    After making the payment PayPal will send an IPN notification and WPAdverts will log some additional data.

    You can go to wp-admin / Classifieds / Payments History edit the last payment and scroll to the bottom you should see the additional debug data logged there, you can copy it and paste here i will see if there is anything incorrect there.

    Thread Starter fabiano1987

    (@fabiano1987)

    mmm i’ve no luck with this thing

    https://www.ispazio.net/wp-content/uploads/2019/05/Schermata-2019-05-20-alle-16.49.35.png

    that’s what i have after the payment.. the log is empty

    Plugin Author Greg Winiarski

    (@gwin)

    Can you send me an email via the contact form here https://wpadverts.com/contact/ i will send you back a customized version of the wpadverts-paypal-standard.php file which should log the information correctly?

    Plugin Author Greg Winiarski

    (@gwin)

    Hi @fabiano1987, i have received your email and sent you back a reply (about 5 days ago), but did not hear back from you, i am not sure if you got my reply or not?

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Problem with PayPal Payments. Cannot be verified and automatically show ads’ is closed to new replies.