Support » Plugin: Accept Stripe Payments » “Invalid Stripe Token” thrown when “Price” not set

Viewing 6 replies - 16 through 21 (of 21 total)
  • Thread Starter Ian McDonald

    (@drianmcdonald)

    (Marked unresolved, because I think I’ve found something going wrong between the JS and the WP Plugin)

    Plugin Author mra13

    (@mra13)

    okay lets look at it step by step.

    First of all, you can’t have ANY shortcode without the “name” parameter in there. The following shortcode you are using is missing the “name” parameter so that needs to be fixed:

    [accept_stripe_payment price=”10″]

    You must use the name parameter to give this item a name, for example:

    [accept_stripe_payment price=”10″ name=”Payment for XYZ”]

    Please edit ALL Your shortcodes in that page then add the name parameter in the shortcode.

    Also, you must upgrade to v1.5.3. Please go to the plugins menu and upgrade the plugin to v1.5.3 (I have added a check in that version so it can show a message when people fail to specify an item name in the shortcode).

    After you do the above then let me know what other issue you see.

    Thread Starter Ian McDonald

    (@drianmcdonald)

    Yes, I’d added the name parameter back in. And had upgraded to 1.5.3.

    The JS error I detected in the last example was for this shortcode, from the tutorial:
    [accept_stripe_payment name="Test donation for a good cause" button_text="Donate Now"]

    And when this happens, I see the issue as reported. The page throws this Javascript error on loading:

    stripe-handler.js?ver=1.5.2:6 Uncaught TypeError: Cannot read property 'data' of undefined
        at HTMLInputElement.<anonymous> (stripe-handler.js?ver=1.5.2:6)
        at Function.each (jquery.js?ver=1.12.4:2)
        at a.fn.init.each (jquery.js?ver=1.12.4:2)
        at HTMLDocument.<anonymous> (stripe-handler.js?ver=1.5.2:4)
        at i (jquery.js?ver=1.12.4:2)
        at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2)
        at Function.ready (jquery.js?ver=1.12.4:2)
        at HTMLDocument.K (jquery.js?ver=1.12.4:2)

    And typing in “5” in the box and pressing the button takes me to the unprocessed “Checkout-Result” page with the error message “Invalid Stripe Token”.

    Plugin Author mra13

    (@mra13)

    I can’t figure out what is going on this site unfortunately. I have looked everything i can from my end but I have run out of ideas. I know the plugin itself is working fine but I can’t figure out what is conflicting on this site.

    Thread Starter Ian McDonald

    (@drianmcdonald)

    What’s the expected behaviour, in terms of (i) the stripeHandlerX javascript static variables, and (ii) the data-stripe-button-uid attribute on the handler? It’s one thing for me to point out that they start counting at stripeHandler0 & data-stripe-button-uid=1, but which one is wrong?

    If I’m right, I could kludge a solution by amending the Javascript to subtract one from the uid, but that feels a zillion kinds of wrong. In fact, I could hardcode the uid to be zero, as I only want one box on a page. But still. So very wrong.

    But before I even consider kludging it, I’d still like to know I’m fixing the right problem.

    Thread Starter Ian McDonald

    (@drianmcdonald)

    I got impatient and tried the kludge, and it didn’t work. The mismatch is only symptom.

    My kludge was to insert the code below into the page, so that the stripehandler hash was found at stripehandler1 as well as stripehandler0. With this the page loaded with no Javascript errors, but pressing the button still took me to the “Checkout-Result” page with an “Invalid Stripe Token” error.

    It would be useful to know whether it’s the UID in the HTML, or the Javascript variables, which are wrong.

    <script type=’text/javascript’>
    /* Kludge because the plugin seems to be starting the input attributes at 1 & the variables at 0. Will break if there is more than one Button on the page. */
    /* <![CDATA[ */
    var stripehandler1 = stripehandler0;
    /* ]]> */
    </script>

Viewing 6 replies - 16 through 21 (of 21 total)
  • The topic ‘“Invalid Stripe Token” thrown when “Price” not set’ is closed to new replies.