Pay-Per-View: wrong page redirect after one-time view payment

Hi, I’m using the Pay-Per-View plugin and I’m doing some tests in paypal sandbox mode.

I created a Paypal app from the developers dashboard, the sandbox mode provides me 2 fake accounts: a buyer and a facilitator. I set the facilitator API credentials into the plugin settings.

Now, when I try to do a one-time view payment, I use my fake buyer credentials to login, I confirm the payment and then Paypal redirects me to the home page of my website.

Moreover, the paypal transaction doesn’t exists.

How can I resolve this? Where am I doing wrong?

Thank you

  • Riccardo
    • New Recruit

    Hi, unfortunately I can’t switch to a live account right now, but I’ve just enabled support access.

    If it could be useful: I’m not using the shortcode to protect the content, I’m using the wpmudev_ppw_html() function directly into the template.

    Thank you

  • Riccardo
    • New Recruit

    (partially) solved! My custom post was private, and I’m using a redirect plugin to manage 404 error, so I temporarily switched my custom post to ‘public’ and now it redirects to the right page, but after the payment I can’t see the transaction and the content is still locked.

  • Riccardo
    • New Recruit

    Solved! I think there’s a conflict between Pay-per-view and WPML or some other plugin that filters the get_permalink() function, or something related to this plugin and custom post types. I discovered that the returnUrl format returned by get_permalink() in the paypal-express class was like this:

    %home_url%/%post_slug%

    instead of

    %home_url%/%custom_post_type%/%post_slug%

    so I had to edit the paypal-express.php file (sigh) at row 70 like this:

    $this->returnURL = home_url()."/custompostname".str_replace(home_url(), "", get_permalink($post_id)). "?ppw_confirm=1";

    now it works, I know that maybe it’s not a good practice, but I needed to make it work :slight_smile: