PPV not completing transaction

I have installed PPV on the following page:

http://new.safetysourceproduction.com/?page_id=3083

I have all of the paypal express settings populated. When I try to pay to see the PPV section, I am redirected to paypal as expected, log into my paypal account sucessfully, paypal correctly displays the price, and I select my payment method. When I then click the continue button in paypal, the screen puts up the paypal wait icon briefly and then returns me to the page on my site without enabling the PPV section.

I never receive a notice of payment being made from paypal so I must assume the transaction is failing but without any information on why.

Reloading the page on my site does not expose the PPV content.

There is no button on my page when paypal sends me back to it to confirm the price.

What is going wrong?

  • arees

    I asked the client if IPN was turned on and whether there was an entry in the paypal IPN history and they responded with this:

    -----------------------------
    The API information wasn't turned on. It needs a notification URL that we need to specify. I need to know what to put there then I can turn it on.
    -----------------------------

    We are running PPV on several products so I'm not sure what the notification URL would be. Do you have a document covering how to setup paypal to work with this plugin?

  • aecnu

    Greetings arees,

    Thank you for the additional input, it is appreciated.

    The notification URL could be anything, it just must be something. PayPal will return the IPN to the originator regardless of what is in the notification URL.

    Therefore I would have them set it to there domain name since they do not have other software intercepting the IPN's and parsing them. There is a need for this, but not in this case.

    Please advise that this does indeed do the job for you folks.

    Cheers, Joe

  • arees

    Ok, I changed the permalinks to %postname% and that made a difference. Now when I click "Continue" in paypal I am brought back to the PPV page on my site and the PPV button says "". I click the button and get the PPV page again with this error at the top:

    Warning: setcookie() expects parameter 3 to be long, string given in /home/safety/www/new/wp-content/plugins/pay-per-view/includes/paypal-express.php on line 474

    Warning: Cannot modify header information - headers already sent by (output started at /home/safety/www/new/wp-content/plugins/pay-per-view/includes/paypal-express.php:474) in /home/safety/www/new/wp-includes/pluggable.php on line 881

    I am not using the Bad Behavior plugin.

    I have attached images of the post with the PPV and the PPV settings as well as the listing of plugins. Hopefully, this will give you some insight.

    We are getting closer

  • aecnu

    Greetings arees,

    Thank you for your additional input and a special thanks for the screen shots.

    On screen shot 2 you are missing the cookie timing, not that this is causing your issue but ...

    Wow looking at your plugins I see you are using search everything, I did not know there was a plugin for that, I use it on my PC and love it, not the WP plugin of course.

    Can you please post the URL to the PPV for me so I can check it out?

    Please advise about setting the cookie and the PPV URL.

    Cheers, Joe

  • arees

    The URL for the post is:

    http://new.safetysourceproduction.com/avian-flu-the-facts-12-min/

    I tried setting the cookie timing to 0 and still received this after clicking on "Confirm 1 USD payment to see this content" (I also dropped the price to $1 for testing):

    *********Start Error Message**************
    Warning: setcookie() expects parameter 3 to be long, string given in /home/safety/www/new/wp-content/plugins/pay-per-view/includes/paypal-express.php on line 474

    Warning: Cannot modify header information - headers already sent by (output started at /home/safety/www/new/wp-content/plugins/pay-per-view/includes/paypal-express.php:474) in /home/safety/www/new/wp-includes/pluggable.php on line 881
    **********End Error Message**************

    When I set the cookie timing to 2, the PPV tool works! This leaves me wondering what this setting controls. I am afraid that the sentence that goes with the setting doesn't help me. The tip for the setting says:

    Validity time of the cookie which lets visitor to be exempt from the protection after he/she liked. Tip: If you want the cookie to expire at the end of the session (when the browser closes), enter zero here.

    What does "exempt from the protection after he/she liked" mean? I am not using a Facebook login so I don't know about any liking. Apparently, setting the value to zero doesn't work for my installation.

    It appears that this sets the number of hours for which the user can reload the PPV content without having to pay for it again. I really want this to be set to 0, as in they get to load the content once and that is it. In this case, the content is an expiring video stream. The user needs to start the video playing promptly or it expires.

    With the cookie expiration set to 2, it appears that they can comeback and reload the page at any time within the next 2 hours and restart the video without paying for it. Can the PPV plugin support setting this to 0 (meaning you only get to load the page once) or a value less than one hour?

  • aecnu

    Greetings arees,

    All right, we are getting some where once again!

    This appears to be a session issue of some kind when setting this for zero.

    Now we can also try a couple of things here, one is to set it to zero and add this code <?php ob_start(); ?> before <!DOCTYPE html> tag in header.php to see if it fixes the header warning messages and if it then works as anticipated.

    Alternatively see about setting the time to 0.5 or .5

    Please let me know your results in any event.

    Cheers, Joe

  • Patrick

    @arees

    Just checking if this issue was eventually resolved in another thread? Or by yourself separately to us? Or by us over email with you? Or using our live support?

    If so, no need to reply, that’s great news.

    If not, or you have any more questions related to this thread, please feel free to post them below including any new symptoms or errors and tick the ‘Mark as Not Resolved (re-open)’ box below the post area (or else we’ll miss it!)

    Otherwise, happy days, glad you got it sorted :slight_smile:

    Thank you for being a WPMU Dev member!

  • arees

    I'm finally back. Actually, my client is back so I am back on this again.

    I have updated header.php to start as follows:

    <?php ob_start(); ?>
    <?php
    /**
     * The Header for our theme.
     *
     * Displays all of the <head> section and everything up till <div id="main">
     *
     * @package WordPress
     * @subpackage Twenty_Eleven
     * @since Twenty Eleven 1.0
     */
    ?><!DOCTYPE html>

    But I still get the same error message:

    *********Start Error Message**************
    Warning: setcookie() expects parameter 3 to be long, string given in /home/safety/www/new/wp-content/plugins/pay-per-view/includes/paypal-express.php on line 474

    Warning: Cannot modify header information - headers already sent by (output started at /home/safety/www/new/wp-content/plugins/pay-per-view/includes/paypal-express.php:474) in /home/safety/www/new/wp-includes/pluggable.php on line 881
    **********End Error Message**************

    Setting it to 0.5 does allow access to the PPV section, but I don't think that gets me what I want.

    What my client really wants, is that the customer only gets to load the contents once when they make the payment. If they want to reload the page they will need to pay again. How can I get that to work.

  • Patrick

    Hiya @arees

    What my client really wants, is that the customer only gets to load the contents once when they make the payment. If they want to reload the page they will need to pay again. How can I get that to work.

    I may be able to help out here. Earlier this year, I managed to get a pay-to-post feature working just fine and wrote a little tutorial here:
    https://premium.wpmudev.org/forums/topic/enable-your-users-to-pay-per-post-or-create-your-own-advertise-on-this-site-ad-system#post-201628

    The main thing is to get the pay-per-view cookie to delete itself once the user has clicked a button. Ideally, in your case, I'm thinking this would be the payment confirmation button once the user has completed payment at PayPal. But if you have another button action after payment confirmation, it may be better to use that button's name instead.

    The following snippet added to your theme's functions.php should get you going.

    add_action('init', 'clear_ppv_cookie');
    function clear_ppv_cookie() {
     if ( isset( $_POST["ppw_final_payment"] ) ) { // Name of the submit button
    setcookie("pay_per_view","",time()-3600,"/");
    }
    }

    Hope this helps! And thanks for being a member :slight_smile:

  • aecnu

    Greetings arees and Patrick Cohen,

    Thank you Patrick for chiming in here with the coding which indeed may resolve these issues when things are applied correctly.

    @arees Please first update your installation to the latest version 1.4 and then set your cookie for 2 or more.

    Next apply Patrick's coding snippet into your installation as directed above and test.

    Please advise if all issues have now been resolved.

    Looking forward to hearing from you in any event.

    Cheers, Joe

  • arees

    I have updated my installation to version 1.4 and set my cookie for 2. I added Patrick's coding snippet to functions.php as follows:

    <?php
    
    // Add EDN widgets here
    function edn_widgets_init() {
    
    	register_sidebar( array(
    		'name' => __( 'Catalog Sidebar', 'twentyeleven' ),
    		'id' => 'catalogsidebar',
    		'description' => __( 'The catalog sidebar', 'twentyeleven' ),
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget' => "</aside>",
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );
    
    }
    /** Register sidebars by running edn_widgets_init() on the widgets_init hook. */
    add_action( 'widgets_init', 'edn_widgets_init' );
    
    // In child themes the functions.php is applied before the parent
    // theme's functions.php. So we need to wait for the parent theme to add
    // it's filter before we can remove it.
    add_action( 'after_setup_theme', 'edn_child_theme_setup' );
    
    function edn_child_theme_setup() {
    // Removes the filter that adds the "singular" class to the body element
    // which centers the content and does not allow for a sidebar
    remove_filter( 'body_class', 'twentyeleven_body_classes' );
    }
    
    // Added to support one time viewing under PPV
    add_action('init', 'clear_ppv_cookie');
    function clear_ppv_cookie() {
     if ( isset( $_POST["ppw_final_payment"] ) ) { // Name of the submit button
    setcookie("pay_per_view","",time()-3600,"/");
    }
    }
    
    ?>

    Now when I click the confirm button I am dropped back into the page looking at the click to purchase button again. The content is never revealed.

    Without the code added to functions.php the content is revealed, but if I navigate away from the content and then return the content is still visible.

  • arees

    Joe,

    I have tried setting the timeout to 0.01, but it does not achieve the results my client desires. As I understand it, setting the timeout to 0.01 would cause the ability to see the PPV content to be lost very shortly after the browser is closed. My client wants the ability to see the PPV content to be lost as soon as they navigate away from the page with PPV content or when they reload the page.

    Andy

  • aecnu

    Greetings Andy,

    Thank you for the clarification which is absolutely appreciated.

    The last shot we have is if the lead developer has any input to offer or idea other then those we covered earlier in this post.

    I will see if I can get the lead developer in here with his invaluable insight into this plugin for his advice/advise for us.

    Though this may take a bit longer then a normal ticket, I will try to get him in here asap.

    Cheers, Joe

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.