#avneet-paymentintent-idempotency
1 messages · Page 1 of 1 (latest)
Can you share the two requests you make that you expected to be a replayed response?
Logs are not up-to-date
What do you mean?
I tried this today but dashboard contains logs till Nov 20
This is the exception: Try using a key other than '6b5830c1-f14a-3505-9ac3-4fe8d48a251b' if you meant to execute a different request.; request-id: req_Xwx5x8PWZNpDgi"}]}
My query is if the payment has not happened then we should be able to use the same idempotent key for the subsequent transaction, right?
Only if it uses the same parameters
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Here is the first request you make with that idempotency key, which is with a different amount
So no, you cannot use the same idempotency key with a different amount
I dont see any log with the link you shared
Can you see the one in the error you shared?
https://dashboard.stripe.com/test/logs/req_Xwx5x8PWZNpDgi
If not, you might be logged in to a different stripe account
That error one dates back to Nov 17. I am using just this account..
I'll summarize the issue:
- Generating idempotent key using amount & currency.
- Going to payment page but not confirming payment yet.
- Edited personal info page and then came back to payment page. Amount & currency is same so same idempotent key is generated.
- Trying payment but it is failing due to "Keys for idempotent requests can only be used with the same parameters they were first used with. Try using a key other than '6b5830c1-f14a-3505-9ac3-4fe8d48a251b' if you meant to execute a different request"
Amount & currency is same so same idempotent key is generated
this is not true, theamountis different in the second instance
But you are checking for Nov 17. Issue happened today. How can you confirm the amount is different. Were you able to search with the given idempotent key ?
Also, if the amount is different I am generating a different idempotent key and then making payment. That works fine..
Sorry, i made a small mistake, looking again
the middle two used different parameters than the original, so they failed
the last one used the same parameters, so it got the replay
Can you share the date or intent id because you are sharing the request that are not very useful I am not able to find in my logs
What account are you logged in to? Last 4 chars on this page in the top right: https://dashboard.stripe.com/settings/account
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
acct_xxxx....yyyy
acct_1Nb6jqIaKiBZl9jC
Thats not the account being used to make these requests
You need to switch to acct_1....1x0R
I am logged in with avneet.singh@hrblock.ca
Which email id you want me to switch to?
I can't share that info
If you have access to other accounts, you should switch and check the account ID where i showed
Ok so you are saying I am using same idempotent key to make different payment requests thats why I am getting this error?
Yes
specifically:
{
automatic_payment_methods: {
enabled: "true",
},
amount: "8000",
currency: "CAD",
}
instead of
{
amount: "8000",
currency: "CAD",
payment_method_types: {
0: "card",
},
}
You seem to be switching from manual to automatic payment method types
What does the switching of automatic payment method types to manual mean?
Defining the payment method types explicitly with payment_method_types vs using automatic_payment_methods. Read more here: https://stripe.com/docs/payments/payment-methods/integration-options#choose-how-to-add-payment-methods
I have used automatic because I intend to do payment through google pay and apple pay as well
Sure, that's all fine, but for idempotency keys the parameters are changing, thats all
If any parameters change, you can't use the same idempotency keys
What are the parameters?
All of them
You mean the one that are used to generate idempotent key. In this case amount, currency, skuCodes etc?
No, how you generate the key does not matter
It's the parameters sent to the stripe api on the request
Unless those are identical, you cannot reuse the provided idempotency key
I am trying to understand this. What do you mean by parameters?
API parameters, like amount above
these are a sampling of the parameters you provided in the requests i shared
These requests used the same idempotency key with different parameters, and that is not allowed
If you can just let me know what are the parameters I will try to fix it. I dont need the values of parameters but just want to know which all parameters are sent to stripe?
From what I can see in 1 of the logs is the response parameters but there is no request parameter so I am not sure which parameters are you talking about:
Also, you said that I used different parameters but all I used is a different zip code..
You need to look at these requests
I've shared all the information you need to see the differences here
I am thinking whether idempotent key is even needed if its causing so many issues
avneet-paymentintent-idempotency
@covert frigate that's up to you. Idempotency keys are used to ensure that when you run the same request twice it can't cause the side-effects twice. You don't want to charge someone $100, but you have a crash so you try again and now they paid you $200. The point of the idempotency key is to say "I am doing the same request I did earlier please only run it if you never did".
So if you try to create or update a PaymentIntent and change the parameters of your request, it doesn't really make sense at all to use idempotency there. That means you kind of misunderstood it completely.
My colleague already clearly shared with you the exact information earlier with the exact Dashboard link. All you have to do is load the 4 requests and compare them
I dont have access to that account. Would really help if you can elaborate on what are the request parameters. I dont need to know the values..
From what I can see from 1 of the logs is that request parameter has only these 3 values:
One of the requests you passed payment_method_types, another you passed automatic_payment_methods. Completely different integration.
So you are saying if 1 of them changes and I am trying to make payment request with same idempotent key it will fail?
yes that's the whole point of idempotency. It's only used to retry requests that had a network issue for example to avoid charging twice.