PayPal Pro duplicate payment error

I've been using Pro Sites for a while with PayPal Express, but I finally signed up for PayPal Pro. When I enable it and try to upgrade a site, I get the following error:

Whoops, looks like you may have tried to submit your payment twice. You may have already paid! Check your subscripton info below to confirm

(Note the typo: subscription is misspelled.)

Nothing shows in the Account History table in the Pro Sites admin, and nothing is showing in my PayPal history either.

I had previously set that account to permanent status, and revoked it specifically for testing. I saw one other person mention this error, but they never posted a resolution.

Thanks,

Chris

  • Chris M.
    • Site Builder, Child of Zeus

    After a little more digging, I've narrowed it down to the credit card checkout nonce field. I can't for the life of me figure out why yet, but when the credit card field is printed, the nonce field that's printed is different than the nonce field that's stored in the usermeta table. I'll continue debugging. Any idea what might be causing this?

  • Chris M.
    • Site Builder, Child of Zeus

    OK—I figured out what's going on. I'm using a WooThemes theme that includes the "WooNews" widget. This widget lists recent posts include excerpts, and I'm guessing it uses The Loop to do so. Pro Sites apparently loads itself into every loop on the designated page, thus calling nonce_field() once each loop (in this case 9 loops—1 for the main page and 8 in my sidebar).

    I've temporarily fixed the problem by removing that widget from my upgrade page. But it's definitely a bug, and is likely to affect other WooThemes users…

  • Aaron
    • CTO

    Good catch, unfortunately I don't know if there is any way to work around other code that does things strangely. The plugin clears all hooks tied to 'the_content' filter to try to avoid this. But it seems your widget is somehow adding those hooks back in way later than they should.

    Is there any add_filter('the_content' in that widget code? And does the widget print in the html before or after the checkout form?

  • Chris M.
    • Site Builder, Child of Zeus

    I haven't tested this, but on line 616 of pro-sites.php you currently have:

    if (!$this->get_setting('checkout_page') || get_queried_object_id() != $this->get_setting('checkout_page'))
    return;

    What if you changed this to:

    if (!$this->get_setting('checkout_page') || get_the_ID() != $this->get_setting('checkout_page'))
    return;

    In other words, rather than checking the ID of the queried page, check the ID of the current page in the The Loop. That should fix this problem, and actually would make Pro Sites a little more flexible to very specific edge cases.

  • Timothy
    • Chief Pigeon

    Hey there! :slight_smile:

    Just checking in to see how things are going with this one and if you need any further help. :slight_smile:

    We haven't heard from you on this thread for a while, perhaps you got help over email. I'm going to presume your all fixed up now and don't need any further assistance.

    However if you have more questions or need some more help then please feel free to respond in this thread or create a new one and we will be more than happy to offer assistance. :slight_smile:

    Take care.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.