#spoon-submit-double
1 messages · Page 1 of 1 (latest)
Hey @pale kayak ! We help in real time in this server and quickly archive threads once the discussion is either resolved or inactive for a while.
I'm happy to help if you have a follow up question though
spoon-submit-double
I need to know that the try block code below the stripe call will NOT run a second time when there is a dup since we used the code to catch a duplicate, and if there is a second attempt it throws the error (exception) but it redirects to the last end place, like success....
We (Stripe) do nothing specific here. It's all fully your code in python.
So I think what you want is to add clear logs to the code and debug this step by step to figure out what you're doing and how to make sure the right part(s) of the code are called
since the top if the try block runs first and if it fails it runs the exception, but with the idem key in use now it goes to the last success url, but does it do that through headers or through the code in the try block following the stripe call?
I'm sorry I don't really understand what the words you're using could mean. There's no "success url" server-side. You as the developer control everything and what happens next
my code redirects to a success page when the payment succeeds. If there is a duplicate, the second call now redirects to the last url - that's the function of the idempotency_key...I'm tryin to understand how that works under the hood.
the second call now redirects to the last url - that's the function of the idempotency_key...
I don't see the link with idempotency. All Stripe does is return the API Response associated with your previous attempt if you re-use an idempotency key. There's nothing else to it from Stripe's end
Ok, I figured it out: idempotency_key does nothing effectively
yeah it's kind of a "cache" entry to a previous attempt
sure, it reruns the success, but it actually runs the success code twice, so how do I know that there was an error on the second attempt?
you get the same exact response as last time, so you go in the catch the same way
So this didn't really solve anything - the duplicate transaction still occurs - only one payment is captured, but HOW do I know the second should not process because it's a dup? It's like Stripe knows, but you don't report the exception, instead to rerun the transaction and ignore the duplicate payment
so still...nothing works
it doesn't just return the same API response, it runs the whole code like it ran a second transaction
but you don't report the exception
we absolutely do
how do I know (from the stripe call) that the second one is a dup, if it's not throwing the exception
?
not with idempotency_key
I'm 100% certain what you say is incorrect. I could still be wrong mind you, but right now I'm certain I'm not
it's not running the exception block when the dup happens - it's running the rest of the try block (in the case of success)
it's really easy to reproduce yourself in basic python code without any front end
so how then?
I don't know. Honestly I'm not sure how you ended up with idempotency but it's the wrong advice, that's not what idempotency is for. It's not here to protect you from a bug in your code
how do you get the exception details when no exception is thrown because it reruns the success code like it made the second payment
from you guys
YOU told me to do that on this thread (or the previous one)
it was the solution you told me to try
(if not you personally, once of the people I chatted with around the same time at stripe - history is there)
Sure but I'm telling you this is just a hack, the double transaction is from your code and is still what you really need to fix.
what bug? NO ONE has been able to tell me what's actually happening
ok, so what's THE solution?
We're developers, we can give you advice but we don't know your exact set up and environment and what's causing your own code to happen twice (which I confirmed myself with you was happening)
The solution is to figure out why you end up calling the same code twice. I'm not saying it's easy, but that's the right path forward
I sent the entire codebase via email to support when i started a call earlier
I mean we can't debug your entire app, this is something you own, it's your code.
but I have no clue. Nothing the logs, nothing in the network, nothing in the console, appears to actually be duplicating
it's a VERY small app
Remove Stripe, add a log, see the same behaviour happens
one file with maybe 50 lines in the backend and one file with maybe 80 including css and html in the frontend
this is so stupid straight forward that I have no clue AFTER LOGGING AND EVERYTHING what is causing the issue
but it DOESN'T happen with any of my other scripts
same config, etc.
Try removing Stripe from the python code. Remove the Stripe call, keep the log, see it happen twice
That will at least confirm this isn't a Stripe bug and it is something in your code or config running twice
REMOVING STRIPE FOREVER is my next move if I can't fix this soon, I'll need to switch processors if I can't get a straight answer
cool you're back to all caps
I have a working authorize.net setup now with ZERO problems, but we were trying to switch to Stripe
get me someone else if you don't like my caps
just stop and get someone else at Stripe to help
I get you're frustrated that we can't help you. I just don't have the magic answer here. I'm fairly confident this has nothing to do with Stripe right now and is a simple JS bug somewhere we haven't found. I'm trying to help you find said bug
Cool
I'm sick of hearing about it
Please work directly with our support team for help instead https://support.stripe.com/contact. They can look at your exact code and try to help you narrow it down
that is where I started...already in progress...
Sounds good! So I'd recommend continuing with them moving forward for this issue instead of Discord and hopefully they can help you