Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
seajaee opened this issue Feb 2, 2015 · 104 comments

Comments

@seajaee
Copy link

seajaee commented Feb 2, 2015

@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

@EranSch
Copy link
Contributor

EranSch commented Feb 3, 2015

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

@andywozhere
Copy link

Same issue for me I'm afraid.

CiviCRM 4.5.6
Wordpress 4.1.1
Stripe Extension 1.9.1

@EranSch
Copy link
Contributor

EranSch commented Feb 26, 2015

@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

@andywozhere
Copy link

@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
Copy link

@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.

@Upperholme
Copy link

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

@andywozhere
Copy link

@Upperholme yep

@andywozhere
Copy link

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

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

@drastik
Copy link
Owner

drastik commented Feb 26, 2015

@andywozhere Thanks for the update!

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

@andywozhere
Copy link

@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!

@drastik
Copy link
Owner

drastik commented Feb 26, 2015

@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.

@MicahStevens
Copy link

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
Copy link

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!

@richardsplayground
Copy link

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.

@highfalutin
Copy link
Contributor

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.

@laryn
Copy link
Contributor

laryn commented May 26, 2015

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.

@highfalutin
Copy link
Contributor

highfalutin commented May 28, 2015 via email

@twbrooks101
Copy link

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

@enricospada
Copy link

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.

@mattwire
Copy link
Contributor

mattwire commented Sep 3, 2015

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: #95

bjendres added a commit to bjendres/com.drastikbydesign.stripe that referenced this issue Sep 10, 2015
@bjendres
Copy link

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

Our "hotfix" #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.

@jmcclelland
Copy link
Contributor

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 added a commit to progressivetech/com.drastikbydesign.stripe that referenced this issue Sep 16, 2015
Due to changes in CiviCRM you can no longer count on hidden_processor
field being present.

See https://issues.civicrm.org/jira/browse/CRM-15743
@jmcclelland
Copy link
Contributor

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: #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)

drastik added a commit that referenced this issue Sep 16, 2015
issue #76: Handle pay later in civi 4.6 (remove hidden_processor check).
@arborrow
Copy link

OK, So I am finally able to turn my attention back to this issue. My most recent testing has been that I am now not able to reproduce this issue. That said, I am not able to get Credit Card to be automagically selected either despite the fact that it is the default (and only) payment processor on our site but that is a separate issue. Peace - Anthony

@peoute
Copy link

peoute commented May 18, 2017

I've been following this thread for several months now. @h-c-c thanks for your work on this! I tried the latest 4.7-dev and I think it solved the problem of having more than one form of payment along with Stripe.

I did run in to another issue, though. If Stripe is the only form of payment, and someone uses a 100% discount code (CiviDiscount), I get an error because Stripe expects payment info and of course the user isn't putting it in for $0.

@h-c-c
Copy link
Collaborator

h-c-c commented May 18, 2017

Thanks for the thanks, @peoute! And thanks for the report! I can reproduce this error. Wow, this beast needs e2e (end to end) unit tests so badly, to cover the many combinations and permutations of use cases.

Also, I would have started a new issue for this since the actual error message doesn't at all resemble "Stripe.js token was not passed".

A good issue title might be something like: "Contribution fails with 100% discount and only Stripe"

h-c-c added a commit to h-c-c/com.drastikbydesign.stripe that referenced this issue May 25, 2017
h-c-c added a commit that referenced this issue May 25, 2017
@torrance
Copy link

We encountered this error on a contribution page (eg. civicrm/contribute/transact?id=543545) where there was also an unrelated webform in the sidebar. Both forms appear to have had stripe attached to them, but of course this caused an error where Stripe died since it could not be attached more than once. The result was the stripe-token was not populated and the user-facing error was the cryptic 'Stripe.js token not passed'.

@mattwire
Copy link
Contributor

If you are still having trouble with stripe.js not passed please try my branch which fixes all known instances of this issue: https://github.com/mattwire/com.drastikbydesign.stripe/tree/4.7-mjwconsulting-dev-squashed

If using with drupal webform_civicrm you also need to apply colemanw/webform_civicrm#100

@herbdool
Copy link

@mattwire in your fork have you considered modal forms when viewing a contact (e.g. /civicrm/contact/view?reset=1&cid=31761)? The civicrm-stripe.js file doesn't get loaded because there's no payment processor available until someone clicks to add a membership/contribution.

@mattwire
Copy link
Contributor

mattwire commented May 2, 2018

@herbdool I don't think I understand... You can use stripe with any of the backend "submit credit card payment" contribution functions for event, membership and contribution. Is there some other way you are trying to make a payment?

@herbdool
Copy link

@mattwire now that I've tested our patches again against 4.7.3 #219 (comment) I'm not having a problem with the modals.

For the record, by modal here I mean that by default clicking "Submit credit card payment" will have a popup modal. And this is configurable in Civi settings so that you can also have it refresh for the form instead of showing the form in a modal. In my original testing it was working in the latter but not the former.

@mattwire
Copy link
Contributor

@herbdool So I think that the "modals" work fine in my branch - did you find otherwise?

@herbdool
Copy link

@mattwire like I said above, I initially had problems but with our patches (as listed in the other thread) worked. Can't confirm with your current fork.

We were trying to stay on the main extension but see what we could patch. You seem to have put a lot of work into your fork but too bad we haven't reconciled the two.

@hair-transplant
Copy link

is anyone running it on Joomla 3.8.8 / CiviCRM 5.1.2. ?
Tested 5.x.zip but also 4.7-mjwconsulting-dev-squashed
`Jun 03 22:11:04 [info] ALERT! Unmasked credit card received in back end. Please report this error to the site administrator.

Jun 03 22:11:05 [info] Stripe_Error create_customer:

 Array
(
[error] => Array
(
[code] => resource_missing
[doc_url] => https://stripe.com/docs/error-codes/resource-missing
[message] => No such token: Stripe Token
[param] => card
[type] => invalid_request_error
)

)`
Also posted this in main thread under #255, but had (wrong) hopes that the modified 4.7. helps
Error message is same.

@mattwire
Copy link
Contributor

@hair-transplant Can you test the wordpress-dev branch of my fork: https://github.com/mattwire/com.drastikbydesign.stripe/tree/wordpress_dev - I've added a couple of fixes for wordpress, which may also fix the Joomla issues you were having.

@hair-transplant
Copy link

Took the fork and updated the following files:
Stripe.php
CRM/Core/Payment/Stripe.php
js/civicrm_strip.js

Did use test credit data from Stripe

Error message:
Error Oops! Looks like there was an error. Payment Response:
Type: invalid_request_error
Code: resource_missing
Message: No such token: Stripe Token

Logfile:
Jun 30 09:39:02 [info] Stripe_Error save:

 Array
(
[error] => Array
(
[code] => resource_missing
[doc_url] => https://stripe.com/docs/error-codes/resource-missing
[message] => No such token: Stripe Token
[param] => card
[type] => invalid_request_error
)
)

One more thing:
In life mode Stripe for the membership module is working fine !
Its just the events module where the error occurs, which is really annoying as there is not one single registration which does not end with an error

@mattwire
Copy link
Contributor

mattwire commented Jun 30, 2018

@hair-transplant Please can you paste a copy of all the debug that is printed in your browser console when you submit a payment and it fails? That will tell us where it is failing.

Also, be REALLY sure that your browser is not using a cached version of any files (eg. civicrm_stripe.js)

@hair-transplant
Copy link

Okay, so I did log the console

a) with code from 5.x.zip
VM1205 civicrm_stripe.js:347 civicrm_stripe.js: clearing submit-dont-process VM1205 civicrm_stripe.js:347 civicrm_stripe.js: submit handler VM1205 civicrm_stripe.js:347 civicrm_stripe.js: Not a Stripe transaction, or pay-later VM1226:347 civicrm_stripe.js: clearing submit-dont-process VM1226:347 civicrm_stripe.js: submit handler VM1226:347 civicrm_stripe.js: Not a Stripe transaction, or pay-later VM1227:347 civicrm_stripe.js: clearing submit-dont-process VM1227:347 civicrm_stripe.js: submit handler VM1227:347 civicrm_stripe.js: Not a Stripe transaction, or pay-later Navigated to https://www.XXXXXX.com/index.php?option=com_civicrm&task=civicrm/event/register&Itemid=599&_qf_Confirm_display=true&qfKey=1235002785af67be8c881138c126d54c_7014 VM1250 jquery-migrate.min.js:2 JQMIGRATE: Migrate is installed, version 1.4.1 VM1282 civicrm_stripe.js:347 civicrm_stripe.js: No billing form! inner.html:1 XHR finished loading: POST "https://m.stripe.com/4". (anonymous) @ inner.html:1 t.default @ inner.html:1 h @ inner.html:1 (anonymous) @ inner.html:1 (anonymous) @ inner.html:1 Promise.then (async) t.default @ inner.html:1 t.p @ inner.html:1 (anonymous) @ inner.html:1 inner.html:1 XHR finished loading: POST "https://m.stripe.com/4". (anonymous) @ inner.html:1 t.default @ inner.html:1 h @ inner.html:1 t.b @ inner.html:1 onMessage @ inner.html:1 Navigated to https://www.XXXXXX.com/index.php?option=com_civicrm&task=index.php&Itemid=599&option=com_civicrm&task=civicrm/event/register&Itemid=599&_qf_Main_display=1&qfKey=1235002785af67be8c881138c126d54c_7014 jquery-migrate.min.js?9dbb0e16052dcd826c94d75561822169:2 JQMIGRATE: Migrate is installed, version 1.4.1 index.php?option=com_civicrm&task=index.php&Itemid=599&option=com_civicrm&task=civicrm/event/register&Itemid=599&_qf_Main_display=1&qfKey=1235002785af67be8c881138c126d54c_7014:737 GET https://www.XXXXXX.com/components/com_civicrm/civicrm/i/icons/jquery-ui-52534D.png 404 (Not Found) ?_=1530387587732:2 It looks like Stripe.js was loaded more than one time. Please only load it once per page. (anonymous) @ ?_=1530387587732:2 (anonymous) @ ?_=1530387587732:2
b) with the changes done in wordpress
Used different browser to exclude cache problem
Now script was not running to the end, Apache 500 error
JQMIGRATE: Migrate is installed, version 1.4.1 jquery-migrate.min.js:2:542 It looks like Stripe.js was loaded more than one time. Please only load it once per page. v2:2:7256 2018-06-30T19:53:51.717Z civicrm_stripe.js: clearing submit-dont-process civicrm_stripe.js:363:5 2018-06-30T19:53:51.719Z civicrm_stripe.js: submit handler civicrm_stripe.js:363:5 2018-06-30T19:53:51.720Z civicrm_stripe.js: Stripe is the selected payprocessor civicrm_stripe.js:363:5 2018-06-30T19:53:51.762Z civicrm_stripe.js: Created Stripe token civicrm_stripe.js:363:5 Gewechselt zu https://www.XXXXXX.com/index.php?option=com_civicrm&task=civicrm/event/register&Itemid=599 JQMIGRATE: Migrate is installed, version 1.4.1 jquery-migrate.min.js:2:542 2018-06-30T19:53:54.978Z civicrm_stripe.js: No billing form! civicrm_stripe.js:363:5 Gewechselt zu https://www.XXXXXX.com/index.php?option=com_civicrm&task=civicrm/event/register&Itemid=599

Couple of issues can be seen. Seems to be related to the event manager module, but difficult for me to interprete.

@mattwire
Copy link
Contributor

mattwire commented Jul 1, 2018

@hair-transplant Thanks for the console log. That's exactly what I need. I will take a look at this in the next few days and get back to you hopefully with a fix.
Can you tell me what payment processors you have enabled on the registration page? Only Stripe, or you have others as well?

@hair-transplant
Copy link

Its STRIPE "live key", Paypal , Stripe "test key" and "Pay later" option.
I did test just STRIPE in the past , but as this did not change the situation I had to add other options.
Again, for "Membership" its working fine, its just the event page which is not running !

@mattwire
Copy link
Contributor

@hair-transplant Please can you test the latest release 5.0.beta3 here: https://github.com/mattwire/com.drastikbydesign.stripe/releases/tag/5.0.beta3

I haven't specifically tried to fix your issue yet, but I did test on Joomla with contribution pages and that was working. If it still does not work for Joomla event pages let me know and I will look in more detail.

@BorislavZlatanov
Copy link
Contributor

Hi guys, I was getting the Type: invalid_request_error Code: resource_missing No such token: Stripe Token error on a WordPress site. Moving the extension to the new location for extensions on Wordpress seems to have fixed this.

Old location: /wp-content/plugins/files/civicrm/ext
New location: /wp-content/uploads/civicrm/ext

Putting it out there in case it helps others.

The extensions directory can be changed from Administer > System Settings > Directories.

@yorkshirerose
Copy link

Hi guys, I was getting the Type: invalid_request_error Code: resource_missing No such token: Stripe Token error on a WordPress site. Moving the extension to the new location for extensions on Wordpress seems to have fixed this.

Old location: /wp-content/plugins/files/civicrm/ext
New location: /wp-content/uploads/civicrm/ext

Putting it out there in case it helps others.

The extensions directory can be changed from Administer > System Settings > Directories.

Having similar issue - the extensions directory was already in your 'new' location but found some instructions on a different branch that helped:

Your CiviCRM 'Resource URLs' must be set to the extensions directory
relative to Drupal/CRM base. Example: /sites/all/civicrm_extensions/
NOT the full server path like /var/www/sites/all/civicrm_extensions/
The admin page for Resource URLs is: /civicrm/admin/setting/url

This fixed it for me.

@mwoodward-atd
Copy link

mwoodward-atd commented Dec 16, 2018

Thanks for these ideas -- I also already have the extensions in the new location (which is where they've always been for me), but I have two Stripe payment processors configured and I'm getting the resource missing error on one, but not the other.

I'm attaching a screenshot of my settings -- the top "CiviCRM Resource URL" setting is set in a config file from back when I migrated things from a dev site to a production instance (just deleted the site URL). If I open up the help is tells me these are the expanded values:
[cms.root] (my URL)
[civicrm.root] {my url}/wp-content/plugins/civicrm/civicrm/
[civicrm.files] {my url}/wp-content/uploads/civicrm/

When I try to submit something from the CiviCRM admin using the payment processor that doesn't work, I get redirected to a 404:
[my site]/wp-admin/action=add&cid=2&mode=live

Here's the error in the CiviCRM logs:
Dec 12 21:05:57 [debug] Stripe Payment Error: Payment Response:
Type: invalid_request_error
Code: resource_missing
Message: No such token: [token here]

And here's the error I see on the Stripe side when I try to run a contribution through the payment processor that isn't working:
Request POST body
{
"description": "Matt Woodward (CiviCRM)",
"card": "[token here]",
"email": "[my email]",
"metadata": {
"civicrm_contact_id": "2"
}
}

Response body
{
"error": {
"code": "resource_missing",
"doc_url": "https://stripe.com/docs/error-codes/resource-missing",
"message": "No such token: [token here]",
"param": "card",
"type": "invalid_request_error"
}
}

For what it's worth I did have the webhook URL incorrect when I first started testing this second payment processor but I fixed that several days ago. Just throwing that out there in case something is cached somewhere and I need to clear something out.

I appreciate any ideas anyone has on this. Thanks!
screen shot 2018-12-16 at 9 16 16 am

@yorkshirerose
Copy link

My resource url settings are slightly different (see screenshot)

untitled

Does this help?

@mwoodward-atd
Copy link

Thanks for the suggestion -- changed to that and unfortunately same behavior. It didn't break the payment processor that works, but it didn't fix the one that doesn't.

@mwoodward-atd
Copy link

In my case the problem apparently was due to the fact that I was using an older Stripe API on the payment processor that wasn't working. Upgrading that fixed the token issue so now I just have a different issue to contend with that I think is related to the fact that I've been on alphas and betas of the Stripe extension as it's been getting updated. Thanks for all the help!

@mwoodward-atd
Copy link

Well, spoke too soon. I got a "DB error - already exists" error after upgrading the Stripe API, but once I removed my existing record from the civicrm_stripe_customers table I'm back to the no such token error and get routed to a 404 in WordPress after attempting to submit a contribution. I guess I'll triple-check everything between the payment processor that works and the one that doesn't.

@adevapp
Copy link

adevapp commented Dec 18, 2018

Well, spoke too soon. I got a "DB error - already exists" error after upgrading the Stripe API, but once I removed my existing record from the civicrm_stripe_customers table I'm back to the no such token error and get routed to a 404 in WordPress after attempting to submit a contribution. I guess I'll triple-check everything between the payment processor that works and the one that doesn't.

With the newest CiviCRM version of the module https://lab.civicrm.org/extensions/stripe.git, I found after upgrading that I would receive a similar error. I fixed it by dropping the triggers associated with the civicrm_stripe_customers table, as the entry would create but the trigger would fail.

@mwoodward-atd
Copy link

Thanks! I'll look into that. So you just removed all the triggers associated with that table?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests