#spoon-submit-double

1 messages · Page 1 of 1 (latest)

tender wagonBOT
simple ravine
#

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

pale kayak
#

Ah, you're back!

#

yes, we were talking about the try block and the multiple submits

simple ravine
#

spoon-submit-double

pale kayak
#

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

simple ravine
#

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

pale kayak
#

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?

simple ravine
#

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

pale kayak
#

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.

simple ravine
#

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

pale kayak
#

Ok, I figured it out: idempotency_key does nothing effectively

simple ravine
#

yeah it's kind of a "cache" entry to a previous attempt

pale kayak
#

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?

simple ravine
#

you get the same exact response as last time, so you go in the catch the same way

pale kayak
#

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

simple ravine
#

but you don't report the exception
we absolutely do

pale kayak
#

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

simple ravine
#

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

pale kayak
#

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)

simple ravine
#

it's really easy to reproduce yourself in basic python code without any front end

pale kayak
#

so how then?

simple ravine
#

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

pale kayak
#

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)

simple ravine
#

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.

pale kayak
#

what bug? NO ONE has been able to tell me what's actually happening

#

ok, so what's THE solution?

simple ravine
#

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

pale kayak
#

I sent the entire codebase via email to support when i started a call earlier

simple ravine
#

I mean we can't debug your entire app, this is something you own, it's your code.

pale kayak
#

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

simple ravine
#

Remove Stripe, add a log, see the same behaviour happens

pale kayak
#

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.

simple ravine
#

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

pale kayak
#

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

simple ravine
#

cool you're back to all caps

pale kayak
#

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

simple ravine
#

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

pale kayak
#

I'm sick of hearing about it

simple ravine
pale kayak
#

that is where I started...already in progress...

simple ravine
#

Sounds good! So I'd recommend continuing with them moving forward for this issue instead of Discord and hopefully they can help you