question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android: Keys for idempotent requests can only be used with the same parameters they were first used with

See original GitHub issue

Step why I got the issue

  1. I have upgrade stripe SDK from 10.4.6 to 16.9.0
  2. and try to update on Java android by following this step https://github.com/tipsi/tipsi-stripe/issues/785#issuecomment-861289460
  3. And try to get token by stripe.createTokenWithCard
  4. after hit that stripe API, I got error response like :

idempotency_error Keys for idempotent requests can only be used with the same parameters they were first used with. Try using a key other than 'Publishable Key Stripe' if you meant to execute a different request.

Environment

  1. “tipsi-stripe”: “^9.0.0”
  2. Stripe SDK : 16.9.0

I need your solution how to solve this issue

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
hariantaracommented, Jul 18, 2021

Removing line number 209 in following file can fix this issue. StripeModule.java

Passing publicKey as idempotentKey cause this error.

Existing code: mStripe.createCardToken( createCard(cardData), mPublicKey, new ApiResultCallback<Token>() { public void onSuccess(Token token) { promise.resolve(convertTokenToWritableMap(token)); } public void onError(Exception error) { error.printStackTrace(); promise.reject(toErrorCode(error), error.getMessage()); } });

New code: (Removed mPublicKey) mStripe.createCardToken( createCard(cardData), new ApiResultCallback<Token>() { public void onSuccess(Token token) { promise.resolve(convertTokenToWritableMap(token)); } public void onError(Exception error) { error.printStackTrace(); promise.reject(toErrorCode(error), error.getMessage()); } });

Referral link: https://stripe.dev/stripe-android/stripe/com.stripe.android/-stripe/create-card-token.html

Thanks for your help, I will try first to update tipsi node module first on android side, for first attempt I did add card, and then remove the and, and next once I want to re add again, thats the Idempotency comes out

but currently I move that stripe to Server Side that use uuid v4 to avoid idempotency, it just temporary solution for me

0reactions
mintheinwincommented, Aug 10, 2022

I have the same problem. Can’t add new cards, but can still use them for payment. After removing mPublicKey I can now add cards and everything works. But I don’t know if this might break something else. Is this the correct solution? And when will this be fixed? Last update with the 16.10.0 android sdk was on 2021-06-18 almost a month ago? Does no one else have this problem?

I had the same this issues in implementation ‘com.stripe:stripe-android:20.8.0’ version. But in implementation (‘com.stripe:stripe-android:1.0.4@aar’){ transitive=true } version is fine. What have the problem in the lasted version?

Read more comments on GitHub >

github_iconTop Results From Across the Web

idempotent requests can only be used with the same parameters
As described in the Stripe docs, you can pass an idempotency key with a request, which allows you to make the same request...
Read more >
Idempotent Requests - Stripe API reference
An idempotency key is a unique value generated by the client which the server uses to recognize subsequent retries of the same request....
Read more >
Android: Keys for idempotent requests can only be used with the ...
Keys for idempotent requests can only be used with the same parameters they were first used with. Try using a key other than...
Read more >
Idempotent Requests | Tuna Dev
An idempotency key is a unique value generated by the client which the server uses to recognize subsequent retries of the same request....
Read more >
Understanding why and how to add idempotent requests to ...
Since we already established what idempotency means, idempotent APIs are APIs where any write operations can have effect only once for a given ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found