WordPress.org

Ready to get started?Download WordPress

Forums

Paid Memberships Pro
[resolved] Issue with Stripe payments not working (4 posts)

  1. v0rtex
    Member
    Posted 10 months ago #

    I have been helping a client troubleshoot a problem with their site. They are using the Paid Memberships Pro plugin and sometime within the last month or two the payment process stopped working.

    The site uses Stripe for payments and the behavior I observed initially was that once the payment information was submitted it would submit back to the server and then throw an error indicating that not all fields had been filled.

    I know that that when using stripe.js the payment process is handled by the javascript before submitting to the server so I was somewhat puzzled. I discovered that the inline JS embedded in the document for handling the form submit event and processing the stripe payment (as found in "preheaders/checkout.php" beginning on line 122) had all of the newlines stripped out. Since the first line of that code is a comment it actually ended up commenting out the entire block of code. Is there a reason the newlines would be removed like this? I tried using an old version of the plugin (1.6.1) and it was doing the same thing for me. I am just curious if this behavior is related to this plugin or if it would be caused elsewhere by either another plugin or by wordpress itself.

    I can confirm that when I remove the comments or change to block commenting in that javascript the stripe payments work once again without a problem. I did this to temporarily solve his problem but I'd like to get at the root problem if possible so that this is not a future issue when plugin updates come.

    Thanks

    http://wordpress.org/plugins/paid-memberships-pro/

  2. strangerstudios
    Member
    Plugin Author

    Posted 10 months ago #

    Some common causes:

    * whitespace in your API info. check the payment settings page.
    * other javascript broken on the checkout page

    Not sure what you mean RE line 122. Does it look like this?
    https://github.com/strangerstudios/paid-memberships-pro/blob/dev/preheaders/checkout.php#L122

  3. v0rtex
    Member
    Posted 10 months ago #

    Okay, my original conclusion was a red herring. What I was looking at would be the content returned by the "pmpro_stripe_javascript" function but I just realized that it's not only that code getting the newlines stripped out - it's the whole site. I made my original assumptions/conclusions because I was only looking at the code using the inspector and not actually viewing the full source.

    Turns out my client installed a plugin named "WP-Compress-HTML" that tears out all newlines and spacing from the source and doesn't make any special considerations for javascript. This plugin was responsible for all of the issues. Javascript that has no comments works fine still but as soon as there is JS with "//" all the rest of the code becomes commented out since there is no longer a newline after the comment.

    Thanks for responding to me. This problem is not a problem with PMPro as it turns out :)

  4. v0rtex
    Member
    Posted 10 months ago #

    Marking this as resolved.

Reply

You must log in to post.

About this Plugin

About this Topic