How do I sell PDF, .mobi, etc. using Pay Per View?

I'm trying to figure out how to sell ebooks using Pay Per View. However, I'm finding the instructions don't provide me enough info to get it done.

First, is this the best tool for doing so? If not, I'll gladly move on to another plugin.

Second, if this is the one, it's baffling me. :slight_smile: Don't worry, I'm always just a simple nudge from perpetual confusion, so it's likely me. Can you nudge me back?

Thanks,
Joe

  • Vinod Dalvi

    Hi @Nitrous Cloud

    I hope you are well today and thank you for your question.

    You can sell ebooks using Pay Per View by implementing following instructions.

    For protecting html codes that you cannot add to post content, there is a template function wpmudev_ppw_html. This function replace all such codes with payment buttons and reveal them when payment is done. Add the following codes to the page template where you want the html codes to be displayed and modify as required.

    <?php
    if ( function_exists( 'wpmudev_ppw_html' ) ) {
         $html = '<iframe width="560" height="315" src="http://www.xyz.com/link-to-pdf.pdf" frameborder="0" allowfullscreen></iframe>'; // html code to be protected (required)
         $id = 1; // An optional unique id if you are using the function more than once on a single page
         $description = 'ebook'; // Optional description of the protected content
         $price = '1.50'; // Optional price for a single view. If not set, price set in the post will be applied. If that is not set either, Unit Price in the Global Settings will be used.
         echo wpmudev_ppw_html( $html, $id, $description, $price );
    }
    ?>

    For the above usage you must create a function in your functions.php to call necessary css and js files. Here is an example:

    <?php
    function my_ppv_customization( ) {
         global $ppw, $post;
         if ( !is_object( $ppw ) || !is_object( $post ) ) return;
         // Call this only for a post/page with ID 123. Change as required.
         // If you omit this line, js and style files will be added to all of your pages and caching will be disabled. So it is recommended to keep and modify it for the pages you are using.
         if ( $post->ID != 123 ) return;
         $ppw->load_scripts_styles();
    }
    add_action( 'template_redirect', 'my_ppv_customization', 2 );
    ?>

    Best regards,

  • Nitrous Cloud

    Thanks Vinod,

    I'm wondering if I can try another approach. Let me know what you think.

    I have a contact form that I can set up to auto-respond with the file attached. What if I set up the Pay Per View so that the customer clicks on the format they want the ebook in (epub, pdf, mobi,..). Once they've paid, they're given one-time access to the contact form. They input their email and name, click submit, and their book is automatically emailed to them.

    I don't know if it's the best solution, but I'm going to have to learn a few things either way. The instructions on how to do this stuff is a bit over my head.

    Thanks again,
    Joe