#danilabagroff

1 messages ยท Page 1 of 1 (latest)

wispy sealBOT
grave abyss
#

Hi there! Thank you for joining me ๐Ÿ™‚

twin needle
#
#

Are you trying to create an empty invoice to add invoice items to afterward?

grave abyss
#

req_YozXPEyLpoHQpr

twin needle
#

Or have you already created invoice items are expecting those to be included?

grave abyss
#

req_Q8xPlzhuDN50mU

twin needle
#

Hmm well the request you shared was a replayed response due to reusing a recent idempotency key: https://dashboard.stripe.com/test/logs/req_YozXPEyLpoHQpr

The original request was this one: https://dashboard.stripe.com/test/logs/req_TQBRwI6y3N6Rw9

grave abyss
twin needle
#

That original was at the same time as the invoice item creation, so I suspect you may not have waited for the invoice item request to finish first

grave abyss
#

I have two calls in the python script - are they async?

#

I mean nonblocking and I need to wait somehow before call Invoice.create

twin needle
#

Yea in this case they need to be blocking. The invoice item call will need to succeed before the invoice create call is made.

#

Otherwise you'd expect to continue hitting this

grave abyss
twin needle
#

Alternatively, if you're building this new, I'd suggest inverting things to create the empty invoice first, myself

grave abyss
#

no, this in prod

twin needle
#

Ah, gotcha

#

then yes you need to make sure the item exists (response is successful) before creating the invoice

grave abyss
#

ah, okay, need to find out how to wait properly for a response

twin needle
#

I thought that was the default in Python ๐Ÿค”

grave abyss
twin needle
#

That's a different thing entirely, related to how payments are captured. I just mean the async nature of network requests.

grave abyss
#

I've got you but a bit shocked that Python API is async - just scroll down all examples on github where each call supposed retrieve some structured data immediate

#

not a promise of a data but data itself

#

customers, customer are available straight after

twin needle
#

Yes, i agree. It should complete those calls by default, that's why i'm confused why you're seeing this issue with the calls happening together, when the first one should finish first

grave abyss