#JacquesVivi
1 messages · Page 1 of 1 (latest)
Hi! Let me help you with this.
You shoud use the same idempotency key for one operation, but not per customer/payment etc.
You can check if the Customer exists and update it instead: https://stripe.com/docs/api/customers/update
What's your usecase exactly?
Customer make a payment of 120€. With "off_session" option. Then it will be charged of 100€ the 01 december then the 01 march
ON the link I don't see "idempotent_requests"
Sorry I d'ont see "idempotency_key" option
You can add idempotency_key to any request. But what you're trying to do should have 2 different idempotency keys, as it's 2 different operations.
Yes
to "any request" you mean shoul I do it on customer creation
or payement intent creation ?
Exemple 1 :
- Creta a customer with idempotency_key cart id
- make a paymentIntent of 120€
- Update the customer idempotency_key
- Then make a 100€ paymentINtent
Or
- Create a customer
- make a paymentIntent of 120€ with idempotency_key cart id
- Then make a 100€ paymentIntent with another idempotency_key
Do you have a strong reason to use an idempotency_key in the first place? (e.g. do you have a complex retry strategy?)
I have a few carts that sometimes have two payments. I do not know why. Could be a connection issue. The idempotency_key seemed like a good technique to implement and avoid this.
It can create more issues and not solve the double charging problem, if you don't know where the problem lies.
hum ok
First you need to identify why this happens and then see if idempotency_key can help you solve this problem.
I will remove It
Do you create 2 PaymentIntents? Because you can only charge the customer once with 1 PaymentIntent.
Yes. When he reloads the payment page. I create a new PaymentIntent
You can check if the customer has a PaymentIntent, and if yes, you can just reuse the existing one.
ok
i will try this
I have implemented the idempotency_key for some customers
I will remove it
But could I have trouble with this for their subscriptions ?
On the next month
?
When I look on the dashboard I can see the idempotency_key : https://dashboard.stripe.com/customers/cus_OJzmULNlhzngHF
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
I think every request gets an idempotency key automatically, but you can set it yourself if you want 2 requests to be idempotent.
Again, it's important to remember that it's just one tool that can help solve some problems, but it has to be used correctly to be effective and not cause more trouble.
If I used it on creating customers. Shouldn't this create a problem for their next paymentIntents ? Exact ?
idempotency_key is not business-logic related. It only acts if you add it to a specific request.
Could you please share a screenshot where you see it?
I don't see it
But I have used it on
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
or
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
I have created this customers with $customer = \Stripe\Customer::create([
'email' => $email,
"preferred_locales" => ['fr', 'en']
], [
'idempotency_key' => $idempotency_key,
]);
It's not persisted on the Customer object, so it won't affect any future requests.
Ok thanks
Happy to help!