Stripe says there is no such token when your server uses it
resource_missingShort answer
Stripe answers with a missing-resource error when the ID you send does not exist for the key you use. In practice: the token came from a test key and the server uses a live key (or the reverse), the token was already spent once, or the value is not a token ID at all. Compare the key modes first.
Fix it fast
1Find out which cause you have
Look at the prefixes. The publishable key in the app and the secret key on the server must both be test or both be live, and the token ID you send must come from that same pair.
# In the app or page: pk_test_... or pk_live_... # On the server: sk_test_... or sk_live_... (or rk_test_/rk_live_) # Token ID sent: tok_...2Match what you see, then jump to its fix
- 1
The app uses a pk_test_ key and the server a live key, or the other way round; the error code may be livemode_mismatch or resource_missing.Test and live modes are mixedFix - 2
The error code is token_already_used, or a second attempt with the same token fails.The token was already usedFix - 3
The error code is resource_missing and the ID does not start with tok_.The value sent is not a token ID, or belongs to another objectFix
- 1
What does the error look like?
resource_missinglivemode_mismatchtoken_already_used
Cause 1 of 3
Test and live modes are mixed
1Check
Each mode has its own keys and objects in one mode are not reachable from the other. A token made with a test publishable key does not exist for a live secret key.
# Print only the prefix, never the full key
echo "${STRIPE_SECRET_KEY:0:8}"2Fix
Use the key pair of one mode everywhere: the test publishable key in the client with the test secret key on the server, or both live. Restart the server after changing the environment variable.
# .env on the server
STRIPE_SECRET_KEY=sk_test_xxx
# client: use the matching pk_test_xxx3Verify
Create a fresh token in the client and send it again.
# retry the payment request from the appConfirmed by docs.stripe.com
Cause 2 of 3
The token was already used
1Check
A token cannot be stored or used more than once. Retries, double taps and a server that charges and then saves the card with the same token all spend it twice.
# check your server log for two requests carrying the same tok_ value2Fix
Create a new token for each attempt. To keep a card for later, save it to a Customer instead of reusing the token.
// server: attach the card once, then use the Customer afterwards
// see Stripe docs: Customers3Verify
The second attempt works with a freshly created token.
# repeat the payment from the app with a new card entryConfirmed by docs.stripe.com
Cause 3 of 3
The value sent is not a token ID, or belongs to another object
1Check
resource_missing means the ID is not valid: the resource does not exist, or the ID is for a different kind of resource. Look at which ID the client actually posts to your server.
# log the field your server reads, and check it starts with tok_2Fix
Send the token ID the client library returned, not a customer, card or payment method ID, and read that same field on the server.
// client: send token.id
// server: read the same body field3Verify
The server log shows a tok_ value and the call succeeds.
# repeat the request and read the server logConfirmed by docs.stripe.com
How do I stop it coming back?
- Keep test and live keys in separate environment files and print only the key prefix in logs.
- Disable the pay button after the first tap so one token is not sent twice.
- Check the Stripe Dashboard request log for the exact ID that failed.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Payments
firebase deploy fails because the Stripe client has no API key
Neither apiKey nor config.authenticator provided
The Stripe client is built from a key that is empty at that moment.
3 causes, each with a fixPayments
Metadata you set on a Stripe Checkout Session is empty when you read it
event.data.object.metadata.order_id is None in the webhook handler
Stripe does not copy metadata between objects on its own.
3 causes, each with a fixPayments
Stripe Elements shows console warnings or errors in a Next.js checkout
Could not find Elements context; You need to wrap the part of your app that calls useElements() in an <Elements> provider.
Most React Stripe.js warnings come from four mistakes: calling loadStripe inside a component, using useStripe or useElements outside the Elements provider, using the objects before they have loaded, and a Content Security Policy that blocks js.stripe.com.
4 causes, each with a fixPayments
Stripe says No such checkout.session when you retrieve a session
resource_missing
A resource_missing error means the ID is not visible to the key you used.
3 causes, each with a fixPayments
A payment method is missing from the Stripe Payment Element, or the call to exclude it fails
Excluding apple_pay, google_pay or link with excluded_payment_method_types returns an error
With automatic payment methods, Stripe decides which methods the Payment Element shows.
5 causes, each with a fixPayments
A Stripe webhook to a Vercel function fails with a 308 redirect
HTTP/2 308
Stripe treats every redirect from a webhook URL as a failure and does not follow it.
3 causes, each with a fix