#danilabagroff
1 messages ยท Page 1 of 1 (latest)
Hi there! Thank you for joining me ๐
Can you share the failing request ID here for me to look at? https://stripe.com/docs/api/request_ids / https://support.stripe.com/questions/finding-the-id-for-an-api-request
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Are you trying to create an empty invoice to add invoice items to afterward?
req_YozXPEyLpoHQpr
Or have you already created invoice items are expecting those to be included?
this case
req_Q8xPlzhuDN50mU
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
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
ah, that make sense, but error message is confusing
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
I have two calls in the python script - are they async?
I mean nonblocking and I need to wait somehow before call Invoice.create
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
Alternatively, if you're building this new, I'd suggest inverting things to create the empty invoice first, myself
no, this in prod
Which you can do using pending_invoice_items_behavior=exclude
https://stripe.com/docs/api/invoices/create#create_invoice-pending_invoice_items_behavior
Then you'd create the items with the invoice id after
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Ah, gotcha
then yes you need to make sure the item exists (response is successful) before creating the invoice
ah, okay, need to find out how to wait properly for a response
I thought that was the default in Python ๐ค
I thought that you meant something close to https://stripe.com/docs/payments/payment-intents/asynchronous-capture-automatic-async
That's a different thing entirely, related to how payments are captured. I just mean the async nature of network requests.
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
and https://github.com/stripe/stripe-python/issues/327 open since 2017
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
I am trying to remaster a bit in this manner, thank you very much, anyways ๐