com.drastikbydesign.stripe icon indicating copy to clipboard operation
com.drastikbydesign.stripe copied to clipboard

Error: Stripe.js token was not passed! Report this message to the site administrator.(ext ver. 1.9.1)

Open seajaee opened this issue 10 years ago • 104 comments

@drastik I am getting this error [Stripe.js token was not passed! Report this message to the site administrator.] when using the Stripe processor with a real credit card number as well as a test credit card number on a live contribution page. Also, I don't know how to write code. :(

CiviCRM 4.4.5 Wordpress 3.9.3 Stripe Extension 1.9.1

seajaee avatar Feb 02 '15 03:02 seajaee

@drastik I suspect this is due to the issue noted on #75 -- where the stripe-payment-form class is not longer getting applied correctly.

EranSch avatar Feb 03 '15 20:02 EranSch

Same issue for me I'm afraid.

CiviCRM 4.5.6 Wordpress 4.1.1 Stripe Extension 1.9.1

andywozhere avatar Feb 26 '15 14:02 andywozhere

@andywozhere Before you submit the form, do you see any errors in your browser's JS console?

If you're using Chrome, be sure to check 'Preserve Log' so the console doesn't clear out after each each page load. I'm sure there's an equivalent in all the others....

image

EranSch avatar Feb 26 '15 14:02 EranSch

@Swingline0 Yes there are a few Javascript errors. It looks like it is omething to do with JQuery. Errors as follow:

Two errors on Common.js line 196 Uncaught TypeError: Cannot read property 'defaults' of undefined and (anonymous function)

// Theme classes for unattached elements
  $.fn.select2.defaults.dropdownCssClass = $.ui.dialog.prototype.options.dialogClass = 'crm-container';
us function)

(anonymous function) error on Common.js line 1077

})(jQuery, _);

Also :

Two errors on en_GB.js line 14 Uncaught TypeError: Cannot read property 'defaults' of undefined and (anonymous function)

CRM.formatMoney('init', "\u20ac 1,234.56");

(anonymous function) error on en_GB.js line 73

})(jQuery);

andywozhere avatar Feb 26 '15 15:02 andywozhere

@Swingline0 Sorry those were after I submitted the form. Before I submitted the form I am told that the file at /wp-content/plugins/files/civicrm/custom_ext/com.drastikbydesign.stripe/js/civicrm_stripe.js?r=GoZZa cannot be found.

andywozhere avatar Feb 26 '15 15:02 andywozhere

And presumably that file does exist on that path in your install?

Upperholme avatar Feb 26 '15 15:02 Upperholme

@Upperholme yep

andywozhere avatar Feb 26 '15 15:02 andywozhere

@Upperholme @Swingline0 Solved (for me anyway). Incorrect resource URL. For me the resource URL was

/wp-content/plugins/files/civicrm/custom_ext

andywozhere avatar Feb 26 '15 16:02 andywozhere

@andywozhere Thanks for the update!

Is this where CiviCRM puts extensions by default in WP? Or is that a directory you set up?

drastik avatar Feb 26 '15 16:02 drastik

@drastik You have to set it up there, but it is the folder recommended on http://wiki.civicrm.org/confluence/display/CRMDOC/Extensions. One concern I had was that the URL is written to https://domain.org//wp-content/plugins/files/civicrm/custom_ext which doesn't feel quite right... but it seems to work anyway!

andywozhere avatar Feb 26 '15 16:02 andywozhere

@andywozhere Right, yes it gets re-written with domain name in there.

You can fix it now, (removing the extra /) I've seen some versions of Civi are doing this.

drastik avatar Feb 26 '15 16:02 drastik

I'm getting this too, trying to troubleshoot. I'm using: CiviCRM 4.6.2 Wordpress 4.1.1

No Javascript errors, I fill out the form and I see the variable being passed from the form:

------WebKitFormBoundaryAc0VWeX4HO8C4Jkw
Content-Disposition: form-data; name="stripe_token"


I don't see any XHR requests going to stripe at all, this is likely the problem. The create customer api call, or whatever this plugin is using isn't working.

I'll keep troubleshooting, I'll update here if I find out anything interesting.

MicahStevens avatar Apr 19 '15 23:04 MicahStevens

Did some more in depth debugging - It appears in chrome at least, if you also enable the pay by check option in your contribution form the detection of whether you're paying by credit card or not isn't working. This part in particular:

 // Handle multiple payment options and Stripe not being chosen.
      if ($form.find(".crm-section.payment_processor-section").length > 0) {
        if (!($form.find('input[name="hidden_processor"]').length > 0)) {
          return true;
        }
      }

My quick fix was to disable pay by check, since we don't need that right away, but I'll work on a pull request to update this code to make it work.

Hope this helps!

MicahStevens avatar Apr 20 '15 00:04 MicahStevens

Same issue for me on :

  • CiviCRM 4.6.2
  • Drupal 7.37
  • Extension version 1.9.1 pulled from github on May 14ish

I get the error in two circumstances:

  1. When multiple payment processors are allowed for an event. For example, PayPal and Stripe.
  2. When the "pay later" option is allowed on an event registration.

No errors appear in the Javascript console.

I was testing in Chrome as well.

Thanks @MicahStevens for your suggested quick fix. I took the route of for now disabling pay later and PayPal. Long term that won't work for us unfortunately.

richardsplayground avatar May 16 '15 07:05 richardsplayground

Same issue here, on:

  • CiviCRM 4.5.8
  • Drupal 7.36
  • Extension version 1.9.1, pulled today, May 18

I get the error on one contrib page, but not on another. The differences that I can see are:

Error No error
Financial type membership donation
Uses price set yes no
Confirmation page no yes
Start date in the past null
Pay later disabled disabled

I don't know if any of these are a clue to what's causing the problem.

No JS errors in the browser console. (Firefox)

Both pages are error-free with extension version 1.7. I was testing the newer version out of the hope that it would help us with recurring contributions, which have been a problem.

highfalutin avatar May 18 '15 07:05 highfalutin

I can confirm the same on a new install from the zip file Github provides (extension 4.6-dev, listed in info.xml as v.1.9.1), on Drupal 7.36 with CiviCRM 4.6.3. (With or without the confirmation page, the same result -- only the error appears after the confirmation page is submitted if that page is enabled, otherwise immediately upon contribution page form submission).

The key factor seems to be the Pay Later option (it works if it is not enabled). I have not tested with a second payment processor option.

laryn avatar May 26 '15 19:05 laryn

Unfortunately the Pay Later option does not seem to be the culprit in my case.

highfalutin avatar May 28 '15 23:05 highfalutin

I've been having the same issue. As long as the "pay later" option is enabled, it's throwing the "Stripe.js token was not passed!" error. Once I removed that option, Stripe processed a live payment just fine.

Wordpress 4.2.2 Civicrm 4.6.2 Fruitful Theme

twbrooks101 avatar Jun 05 '15 21:06 twbrooks101

I'm having the same issue as well. I turned off the Pay Later option, which prevents the error from appearing but also does not process the contribution (just refreshes the page with a blank form, or, if Confirmation Page is enabled, returns user back to the blank form).

Wordpress 4.2.2 Civicrm 4.6.3

EDIT: I managed to install the 4.6dev branch, and, after disabling both Pay Later AND any other payment processor, it worked, same as @richardsplayground and @MicahStevens.

enricospada avatar Jun 16 '15 02:06 enricospada

I get this issue, drupal 7.39, civicrm 4.6.8. No other payment processors enabled, no pay later. The following pull request fixes it for me and seems to allow other payment processors/pay later to be enabled if required: https://github.com/drastik/com.drastikbydesign.stripe/pull/95

mattwire avatar Sep 03 '15 09:09 mattwire

We had the same issues as described above, Drupal 7.39, CiviCRM 4.6.8, pay_later enabled.

Our "hotfix" https://github.com/drastik/com.drastikbydesign.stripe/pull/97 patching civicrm_stripe.js did the trick, STRIPE's working perfectly now. I am, however, not quite sure what this bit of code was intended for in the first place.

bjendres avatar Sep 10 '15 12:09 bjendres

Same issue - drupal 7.39, civicrm 4.6.8 pay later enabled. The pull request in #97 did not work, but disabling pay later did work.

jmcclelland avatar Sep 11 '15 02:09 jmcclelland

There seem to be a few different reasons why people are getting this error. For the "Pay Later" reason - I think i fixed it with this pull request: https://github.com/drastik/com.drastikbydesign.stripe/pull/99

CiviCRM has changed the availability of the hidden_processor field in 4.6 - so that would explain why it works in 4.5 and not in 4.6 (see https://issues.civicrm.org/jira/browse/CRM-15743)

jmcclelland avatar Sep 16 '15 16:09 jmcclelland

I'm having the same issue as well, I'm not quite sure on how to start debugging.

CiviCRM - 4.6.4/4.6.8 Wordpress - 4.3.1 Stripe Payment Processor 1.9.2

I've tried with the default Twenty Fifteen theme, clean Wordpress and CiviCRM install, no extra plugins or extensions. Extensions Resources URL: http://www.site.com/dev/wp-content/plugins/files/civicrm/extensions/ (seems to be correct) No additional payment processors and no 'Pay Later', trying to make payments for Events.

Result:

Sorry but we are not able to provide this at the moment. Stripe.js token was not passed! Report this message to the site administrator.

Backtrace:

#0 /var/www/site/public_html/dev/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(360): CRM_Core_Error::backtrace()
#1 /var/www/site/public_html/dev/wp-content/plugins/files/civicrm/extensions/com.drastikbydesign.stripe-4.6-dev/CRM/Core/Payment/Stripe.php(295): CRM_Core_Error::fatal("Stripe.js token was not passed!  Report this message to the site administrator.")
#2 /var/www/site/public_html/dev/wp-content/plugins/civicrm/civicrm/CRM/Event/Form/Registration/Confirm.php(619): CRM_Core_Payment_Stripe->doDirectPayment((Array:57))
#3 /var/www/site/public_html/dev/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(345): CRM_Event_Form_Registration_Confirm->postProcess()
#4 /var/www/site/public_html/dev/wp-content/plugins/civicrm/civicrm/CRM/Core/StateMachine.php(164): CRM_Core_Form->mainProcess()
#5 /var/www/site/public_html/dev/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Next.php(61): CRM_Core_StateMachine->perform(Object(CRM_Event_Form_Registration_Confirm), "next", "Next")
#6 /var/www/site/public_html/dev/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Event_Form_Registration_Confirm), "next")
#7 /var/www/site/public_html/dev/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Event_Form_Registration_Confirm), "next")
#8 /var/www/site/public_html/dev/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(353): HTML_QuickForm_Page->handle("next")
#9 /var/www/site/public_html/dev/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(312): CRM_Core_Controller->run((Array:3), NULL)
#10 /var/www/site/public_html/dev/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:15))
#11 /var/www/site/public_html/dev/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:3))
#12 /var/www/site/public_html/dev/wp-content/plugins/civicrm/civicrm.php(1189): CRM_Core_Invoke::invoke((Array:3))
#13 /var/www/site/public_html/dev/wp-content/plugins/civicrm/includes/civicrm.basepage.php(134): CiviCRM_For_WordPress->invoke()
#14 [internal function](): CiviCRM_For_WordPress_Basepage->basepage_handler(Object(WP))
#15 /var/www/site/public_html/dev/wp-includes/plugin.php(579): call_user_func_array((Array:2), (Array:1))
#16 /var/www/site/public_html/dev/wp-includes/class-wp.php(633): do_action_ref_array("wp", (Array:1))
#17 /var/www/site/public_html/dev/wp-includes/functions.php(886): WP->main("")
#18 /var/www/site/public_html/dev/wp-blog-header.php(14): wp()
#19 /var/www/site/public_html/dev/index.php(17): require("/var/www/site/public_html/dev/wp-blog-header.php")
#20 {main}

I'm not a developer but if I could help in anyway please let me know, I have a development environment ready for testing.

mecachisenros avatar Sep 22 '15 17:09 mecachisenros

Please test the latest version. I believe it is fixed following this pull request: https://github.com/drastik/com.drastikbydesign.stripe/pull/102

mattwire avatar Sep 22 '15 18:09 mattwire

@mattwire I've tested the latest version, with the latest fix applied. The error above is with the latest version, tested a couple of hours ago.

mecachisenros avatar Sep 22 '15 19:09 mecachisenros

After a lot of trial and error I've created two reproducible ways to trigger this problem.

Setup: Event with Stripe payment processor and pay later option.

Scenario one: Fill out everything, but don't choose either the Stripe payment processor or the pay later option. Hit submit. Page reloads with CiviCRM error message about how you need to select a payment processor. Select stripe and hit submit again. Fails. Scenario two: Fill out everything except one required field. Choose Pay Later option. Hit submit. You get a CiviCRM error about missing field. Fill it in - and then change your mind and choose Stripe as the payment processor. Hit submit. Fails.

The reason both failures is the same:

  • When reloading the page after an error - CiviCRM does not populate the _paymentProcessors property of the form. See Contribute_Form_Contribution_Main::preProcessPaymentOptions() - when the form has _submitValues set - it will only populate _paymentProcessors with the selected payment processor. But in both scenarios, Stripe is not chosen as the selected payment processor.
  • stripe_civicrm_buildForm() is responsible for inserting the javascript code to create the stripe token. However, it is only triggered if _paymentProcessors is populated with a stripe payment processor.
  • There is a fallback - if you click on the Stripe payment processor - the civicrm_stripe.js is injected (which causes Stripe to complain about being injected more than once). However, that doesn't solve the problem - since the code we need injected is wrapped in $(document).ready(function(). Since the page is already loaded - this doesn't seem to be applied.

I'm not sure what the best approach is. Maybe some modification to the code that is injected when you click the stripe payment processor option? It could check to see if it has already been injected and not proceed if it has. However, if it hasn't been injected, perhaps it could run outside the ready() function??

@mecachisenros is stripe the default payment process on your system. I think we would similar errors to what I have experienced if do not have stripe set as the default option.

jmcclelland avatar Sep 30 '15 20:09 jmcclelland

@jmcclelland the tests I made, Stripe Processor was the only payment processor (also the default one), Pay Later disabled, filled in all required fields (ie Contact details from Profile, and Billing Address), no extension installed apart from Stripe. This morning I tested @systopia's fork (ref #97) which seems to fix this issue, the test was in the same environment (no extensions, no Pay later, no additional payment processor) the payment was processed successfully, couldn't process the payment in test mode though, but live payments seem to work. Tomorrow morning I will test Systopia's fix with PayPal enabled and Pay Later and I will report back. I will try having a look at their fix, but as I said, not a developer, just some basic JavaScript knowledge, willing to help though.

mecachisenros avatar Sep 30 '15 22:09 mecachisenros

I just tried a new pull requests to address the problems I've experienced. It involves some re-factoring to simplify the code (I hope):

https://github.com/drastik/com.drastikbydesign.stripe/pull/105

jmcclelland avatar Oct 07 '15 21:10 jmcclelland

Hi @drastik,

I am having issue with PayPal payment processor. I have configured the Stripe on website with PayPal and pay-later option. Stripe is configured as defualt payment processor. Pay later and stripe is working fine. But now issue is, while submitting contribution with PayPal, its giving me an error: "Error: Missing required param: number." which was getting occured previously in case of stripe.

The other scenario is, when there is none of the payment processor is set as default, then Paypal works fine and stripe gets break or is there any conflict when we configured PayPal and Stripe together?

Any idea why this is happenning?

rohankatkar avatar Oct 26 '15 13:10 rohankatkar