WordPress.org

Ready to get started?Download WordPress

Forums

Gravity Forms + Stripe
[Plugin: Gravity Forms Stripe Add-On] Solution to the Invalid Token Error (9 posts)

  1. totomobile
    Member
    Posted 1 year ago #

    Didn't feel right having to pay someone to fix their own plugin.. especially being a dev myself :) So here is how to fix the Invalid Token error:

    -stripe.php line 2103, replace:

    $needle      = "});" .
    					"}" .
    					"jQuery(document).ready(function($){" .
    					"gformInitSpinner_{$form_id}();";

    with

    $needle      = "} );}jQuery(document).ready(function($){gformInitSpinner_{$form_id}();";

    - The error is essentially the new gforms plugin has ONE extra space somewhere where the search and replace happens (right after the first } bracker ). This will allow the stripe js to be inserted again.

    - This fix still requires that the form be in Ajax mode, as the insertion point is based on the gform ajax js code.

    BONUS

    In the backend, my keys would show up as invalid when I put them in. If you are having this issue, try this fix:

    - stripe.php near line 663, replace:

    Stripe_Token::create( array(
    																		 'card'     => array(
    																			 'number'    => '4242424242424242',
    																			 'exp_month' => 3,
    																			 'exp_year'  => $year,
    																			 'cvc'       => 314
    																		 ),
    																		 'currency' => 'usd' ) );

    with

    Stripe_Token::create( array(
    																		 'card'     => array(
    																			 'number'    => '4242424242424242',
    																			 'exp_month' => 3,
    																			 'exp_year'  => $year,
    																			 'cvc'       => 314
    																		 )) );
  2. Rose
    Member
    Posted 1 year ago #

    thanks so much for the fix; I just had a client sign a contract for me only to find my invoice form no longer worked. I'm willing to pay for a premium plugin but this one is free so it should either be upgraded to premium or the fixes should be made available.

  3. Connorski
    Member
    Posted 1 year ago #

    Awesome! Thanks so much.

  4. Jean-Francois Arseneault
    Member
    Posted 1 year ago #

    Beauty, thanks for the code, totomobile!

  5. helms
    Member
    Posted 1 year ago #

    Great job Totomobile? Insterested in forking this code and having your own version? I think most people would love that, since we all know the story behind the current dev of this plugin.

    By the way, does it hang for anyone when making a test purchase?

  6. helms
    Member
    Posted 1 year ago #

    Nevermind, it works now. Totmobile, does this work with GravityForms 1.6.9+

    Thanks

  7. Naomi C. Bush
    Member
    Plugin Author

    Posted 1 year ago #

    Hi totomobile -- wish you would have gotten the whole story before giving out false information about having to pay me to fix the plugin. Anyone who's contacted me can concur.

    Enjoy the *complete* fix when it's released here for free later today :-)

  8. Naomi C. Bush
    Member
    Plugin Author

    Posted 1 year ago #

    Hi helms,

    What story would that be? I don't recall an email from you but please feel free to email me any time if you have a question about what's going on with the plugin.

  9. totomobile
    Member
    Posted 1 year ago #

    Hi Naomi,

    First I want to say thanks for the plugin. Obviously I had to go through the plugin code and it's well written and it seems a lot of users are finding it useful. As a developer I appreciate the work you put in an released for free.

    After encountering the token bug myself, it appeared on the forums that to get the fix I would have to contact you and wait for it. I had a short deadline and I prefer being depended on myself than waiting on someone, so I just fixed it myself.

    So anyways, I don't want to start a polarizing discussion, I just wanted to help people who were having the same issue as me.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.