#avneet-paymentintent-idempotency

1 messages · Page 1 of 1 (latest)

dusky riverBOT
cinder zephyr
#

Can you share the two requests you make that you expected to be a replayed response?

covert frigate
#

Logs are not up-to-date

cinder zephyr
#

What do you mean?

covert frigate
#

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?

cinder zephyr
#

Only if it uses the same parameters

#

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

covert frigate
#

I dont see any log with the link you shared

cinder zephyr
#

If not, you might be logged in to a different stripe account

covert frigate
#

That error one dates back to Nov 17. I am using just this account..

#

I'll summarize the issue:

  1. Generating idempotent key using amount & currency.
  2. Going to payment page but not confirming payment yet.
  3. Edited personal info page and then came back to payment page. Amount & currency is same so same idempotent key is generated.
#
  1. 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"
cinder zephyr
covert frigate
#

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

cinder zephyr
#

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

covert frigate
#

I dont see any of the requests

#

Can you share snapshot pls

cinder zephyr
#

No

#

I can't share that

covert frigate
#

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

cinder zephyr
#

acct_xxxx....yyyy

covert frigate
#

acct_1Nb6jqIaKiBZl9jC

cinder zephyr
#

Thats not the account being used to make these requests

#

You need to switch to acct_1....1x0R

covert frigate
#

Which email id you want me to switch to?

cinder zephyr
#

I can't share that info

#

If you have access to other accounts, you should switch and check the account ID where i showed

covert frigate
#

Ok so you are saying I am using same idempotent key to make different payment requests thats why I am getting this error?

cinder zephyr
#

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

covert frigate
#

What does the switching of automatic payment method types to manual mean?

cinder zephyr
covert frigate
#

I have used automatic because I intend to do payment through google pay and apple pay as well

cinder zephyr
#

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

covert frigate
#

What are the parameters?

cinder zephyr
#

All of them

covert frigate
#

You mean the one that are used to generate idempotent key. In this case amount, currency, skuCodes etc?

cinder zephyr
#

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

covert frigate
#

I am trying to understand this. What do you mean by parameters?

cinder zephyr
#

API parameters, like amount above

cinder zephyr
#

These requests used the same idempotency key with different parameters, and that is not allowed

covert frigate
#

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

cinder zephyr
dusky riverBOT
cinder zephyr
#

I've shared all the information you need to see the differences here

covert frigate
#

I am thinking whether idempotent key is even needed if its causing so many issues

pale pebble
#

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.

covert frigate
#

Ok got it

#

Can you share sample parameters of the request

pale pebble
#

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

covert frigate
#

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:

pale pebble
#

One of the requests you passed payment_method_types, another you passed automatic_payment_methods. Completely different integration.

covert frigate
#

So you are saying if 1 of them changes and I am trying to make payment request with same idempotent key it will fail?

pale pebble
#

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.