#leo_api

1 messages ¡ Page 1 of 1 (latest)

normal orchidBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1299204783470809120

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

tropic shoal
#

One more thing to add - we managed to to retrieve the subscription but still got an error

tropic shoal
#

Error happened while attempting to retrieve all paid invoices:

stripe.Invoice.list(
 limit=MAX_STRIPE_RESPONSE_LIMIT,  stripe_account=stripe_account_id,
       api_key=KEY,
stripe_version=STRIPE_API_VERSION,
        expand=["data.subscription", "data.customer"],
        
status=STRIPE_INVOICE_PAID_STATUS,
    ).auto_paging_iter()
frail pewter
#

req_xxx

tropic shoal
#

@frail pewter looking for it

#

When I search for it only one request is available

#

this is a connected account, not sure if it's related

frail pewter
#

So you may be calling that request from a different account

#

or forgot to use the stripe_account header

#

The not found error is typically when looking for object in a different Stripe account

#

The Subscription belongs to the Standard Connected Account acct_1O5YruBQa0JUCpZ6

tropic shoal
#

I found the line of code that is throwing the error:

case stripe.Invoice:
            subscription = stripe.Subscription.retrieve(                payment.subscription, api_key=config.HUB_STRIPE_SECRET_KEY, stripe_account=payment.stripe_account
)

In this case I am trying to use the stripe_account from the payment

#

this function is used in two places:

  • Handling webhook events received from stripe connect
  • as a script that runs periodically but not initiated by stripe connect

Does that mean when an event is initiated by stripe connect a stripe account id is present in the payment, but if I retrieve a payment and specify an account the account_id is not going to be present is the retrieved payment?

frail pewter
#

not sure I get the last part of your question, but you want to look at which account you are sending request from

#

Does it output a request id in the error?

#

req_xxx

tropic shoal
#

what I meant to say is that we call stripe.Subscription.retrieve from two different contexts:

  • event handlers when we receive stripe-connect events
  • cli - retrieve invoices and then the subscriptions

For event handlers when we receive an event related to an invoice, we pass the stripe account id contained in the stripe event to retrieve the subscription

in the CLI, we retrieve retrieve invoices and then assume a stripe account id is present.

#

let me try

#

unfortunately no req_ present

frail pewter
#

Um but do you know which context that your errored request came from?

#

Can you screenshot the exact error ?