stripe-node icon indicating copy to clipboard operation
stripe-node copied to clipboard

A similar object exists in test mode, but a live mode key was used to make this request

Open knightcode opened this issue 11 years ago • 23 comments

I didn't know where else to post this, but I'm using this lib on our server. While testing, I had tried to add a real credit card to my account, which failed saying that I was in test mode. Now, both my client and server are running in test mode. And, when I try to add that same came, I get this error from the stripe API: No such token: ......; a similar object exists in test mode, but a live mode key was used to make this request.

How can my card object exist in test mode?

knightcode avatar Feb 22 '15 19:02 knightcode

It sounds like your while your client is using your test publishable key, your server is not using your test secret key, but instead using your live secret key.

Note with node you have to restart your node process to update the code thats running (its not like ruby or php where you can just save the code and your changes take place).

Also you can't use real cards in test mode.

matthewarkin avatar Feb 23 '15 04:02 matthewarkin

Hey, so it sounds like you tried to use the token you created in testmode (which exists in testmode) with a livemode key (where it doesn't exist). As @matthewarkin said, please be sure to restart your servers to make sure your updated keys are picked up!

michelle avatar Feb 24 '15 21:02 michelle

One stripe account is in live mode and another stripe account in live mode is trying to connect to the first stripe account in live mode. Earlier the connection had happened successfully in test mode. The connection in test mode was revoked and now the connection is been made in live mode. We still get the message A similar object exists in test mode, but a live mode key was used to make this request.

apur avatar Apr 19 '16 19:04 apur

@apur this doesn't sound like a bug with the Stripe Node libraries thus this issue would be more appropriate for support.stripe.com/email or the developer support chatroom (#stripe on freenode).

I don't think this error has anything to do with the connection process rather you're trying to charge a customer or token object that was made in test mode but you are using a live mode api key.

matthewarkin avatar Apr 19 '16 19:04 matthewarkin

True, thank you for your response. I know I should have done only dropping an email to stripe support which I have and was looking at if I can get support from the community who have faced similar issues. I have deleted the tokens we had saved in the database for the customer who is trying to connect, both the main account and the account trying to connect are in live mode, the stripe secret key, publish key and connect client key are live mode keys. Where could I be going wrong now?

On Wed, Apr 20, 2016 at 1:10 AM, Matthew Arkin [email protected] wrote:

@apur https://github.com/apur this doesn't sound like a bug with the Stripe Node libraries thus this issue would be more appropriate for support.stripe.com/email or the developer support chatroom (#stripe on freenode).

I don't think this error has anything to do with the connection process rather you're trying to charge a customer or token object that was made in test mode but you are using a live mode api key.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/stripe/stripe-node/issues/149#issuecomment-212086586

nisostech.com | LinkedIn https://www.linkedin.com/company/nisos-technologies | @HelloNisos http://twitter.com/HelloNisos | Github https://github.com/nisostech

This email is intended only for the person or the entity to whom it is addressed and may contain information which is confidential and privileged. Any review, retransmission, dissemination or any other use of the said information by person or entities other than intended recipient is unauthorized and prohibited. If you are not the intended recipient, please delete this email and contact the sender

apur avatar Apr 19 '16 20:04 apur

What is the api call that is returning this error?

On Tue, Apr 19, 2016 at 1:26 PM, apur [email protected] wrote:

True, thank you for your response. I know I should have done only dropping an email to stripe support which I have and was looking at if I can get support from the community who have faced similar issues. I have deleted the tokens we had saved in the database for the customer who is trying to connect, both the main account and the account trying to connect are in live mode, the stripe secret key, publish key and connect client key are live mode keys. Where could I be going wrong now?

On Wed, Apr 20, 2016 at 1:10 AM, Matthew Arkin [email protected] wrote:

@apur https://github.com/apur this doesn't sound like a bug with the Stripe Node libraries thus this issue would be more appropriate for support.stripe.com/email or the developer support chatroom (#stripe on freenode).

I don't think this error has anything to do with the connection process rather you're trying to charge a customer or token object that was made in test mode but you are using a live mode api key.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub <https://github.com/stripe/stripe-node/issues/149#issuecomment-212086586

nisostech.com | LinkedIn https://www.linkedin.com/company/nisos-technologies | @HelloNisos http://twitter.com/HelloNisos | Github https://github.com/nisostech

This email is intended only for the person or the entity to whom it is addressed and may contain information which is confidential and privileged. Any review, retransmission, dissemination or any other use of the said information by person or entities other than intended recipient is unauthorized and prohibited. If you are not the intended recipient, please delete this email and contact the sender

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/stripe/stripe-node/issues/149#issuecomment-212111253

matthewarkin avatar Apr 19 '16 22:04 matthewarkin

Hi apur, I am having similar problem too. Error message: "No such token; a similar object exists in test mode, but a live mode key was used to make this request." I have only the test keys (secret and publishable keys) in my local environment. I even tried to force assigning the values of the test_secret_key and test_publishable_key in the same page where the script to create the Stripe payment is. Did you find any solutions from Stripe support?

KatherinaFatiguso avatar Jun 20 '16 04:06 KatherinaFatiguso

@apur, I am having problem with my bash.profile, this is where after the LIVE sk_live and pk_live are added in the .bash_profile, it overrides the TEST sk_test and pk_test. In the .bash_profile at the moment there is only written the TEST sk_test and the pk_test. I tried to source the bash to make sure the update is saved ( in terminal: source .bash_profile). But when I tried to make test payment, it is still using the sk_live and test_live. Where do they come from? I don't get it?? That is why my test payment always failed.

KatherinaFatiguso avatar Jun 20 '16 05:06 KatherinaFatiguso

Hello @matthewarkin, can you please help me with the issue I am having with Stripe payment? Ever since I entered the LIVE sk_live and pk_live keys in .bash_profile, it overrides the test mode and I can not go back to test mode. I made sure that the .bash_profile now has only the TEST sk_test and pk_test keys, restarted the server, refreshed browser, but then it will keep using the LIVE sk_live and pk_live. I displayed the secret_key and publishable_key values and they showed the old LIVE keys that I have removed. It seems like the LIVE keys are stored somewhere and I don't know how to flush it. I typed in terminal: source .bash_profile, restarted server and still showing the LIVE keys. Can you help me please?

KatherinaFatiguso avatar Jun 20 '16 05:06 KatherinaFatiguso

@KatherinaFatiguso there is no need to repeat your to repeat your question 3 times. I'd recommend emailing into support of Stripe's IRC chatroom #stripe on freenode.

How your code gets your keys depends on where you set them, have you grep your code for a pk_test?

matthewarkin avatar Jun 20 '16 14:06 matthewarkin

I'm sorry @matthewarkin , I did the following today in terminal: $ grep 'sk_live' .bash_profile doesn't return anything

$ grep 'sk_test' .bash_profile returns the secret key sk_live

But in my .bash_profile there is only the TEST sk_test and pk_test keys. I don't know where the LIVE sk_live and pk_live keys come from. This happens ever since I put the LIVE keys in .bash_profile, it overrides the TEST key and stayed there, even if I removed the LIVE keys. So confusing. I sent email to Sripe support but I'm still waiting.

KatherinaFatiguso avatar Jun 21 '16 03:06 KatherinaFatiguso

but why are you assuming that Stripe is reading your api keys from environment variables? Have you grepped your actual code for "pk_test"?

matthewarkin avatar Jun 21 '16 03:06 matthewarkin

Encountering this when testing apple pay. I used account A to pay by Apple Pay in test mode (with a test card number, probably doesn't matter), then I used the same account to try Apple Pay in live mode, and it gives this error.

I am under the impression that Apple Pay is a one off token. But why does this happen?

Note this account A is used in live mode and is able to made purchases using CC payment.

EdmundLeex avatar Jan 26 '17 01:01 EdmundLeex

@EdmundLeex This is just our API trying to be helpful. You are trying to charge a token in Live mode but it was created in Test mode. Instead of just saying "we don't know about this token" we tell you explicitly that this token exists but in Test mode so that you know you're using the wrong API key somewhere.

You'll need to make sure that your code client-side uses the Live Publishable key pk_live_XXX if you want to go Live.

remi-stripe avatar Jan 26 '17 01:01 remi-stripe

@remi-stripe The account I am using is actually a production / live mode account. And I am testing on our staging server, which uses live mode keys and secrets. I feel like, since it's a live mode account, shouldn't it be not allowed to create test token to ensure consistency? This account now has live mode credit card token, and a test apple pay token. Is there any way I can get around? (like deleting this test token maybe)

EdmundLeex avatar Jan 26 '17 02:01 EdmundLeex

@EdmundLeex This is a better discussion for support in general as this place is to report bugs in the bindings. I'd recommend that you reach out to our support team directly here if my current answer doesn't help.

The toggle you see on your dashboard doesn't actually affect your ability to create charges in test mode or live mode, it just changes the view on the dashboard. You can always use both test mode and live mode, no matter what that toggle is set to. This is done by specifying which set of API keys you're using to make a charge: https://dashboard.stripe.com/account/apikeys

If your code uses Live keys it will expect a real card number, not a test one and then try to charge that card for real with the bank. If your code uses Test keys it will expect you to use our test keys.

The error you get here means, with 100% certainty, that something in your code is not configured properly. Something, somewhere, is hardcoding the Test Publishable api key pk_test_XXXXXXX instead of using the Live one.

This is a common enough issue and most times, after double or triple-checking the code along with verifying the source in the chrome inspector for example, you can immediately see that the code still uses the wrong key. Depending on how your integration is built, it could be that the key is hardcoded, or that you updated your environment variables but didn't restart the server properly for example.

remi-stripe avatar Jan 26 '17 02:01 remi-stripe

@remi-stripe thank you! I will take a look and reach out to support.

EdmundLeex avatar Jan 26 '17 02:01 EdmundLeex

@remi-stripe You right! In my case it was the javascript of Elements with the test key. Thanks.

danpalmieri avatar Mar 27 '18 18:03 danpalmieri

Purchases are going through just fine, but I am getting these in my inbox still, "...a similar object exists in test mode, but a live mode key was used to make this request."

lppdev avatar May 24 '19 17:05 lppdev

@lppdev This is almost definitely an issue with your integration, not the stripe-node library. You should reach out to support at https://support.stripe.com/email and provide as much information as you can, like the exact times this error occurs and/or request IDs.

ob-stripe avatar May 24 '19 17:05 ob-stripe