#mangle_invoice-payment-intent-relationship

1 messages ยท Page 1 of 1 (latest)

bold fieldBOT
#

๐Ÿ‘‹ 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/1399507317451657239

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

gaunt fern
#

Hello ๐Ÿ‘‹

This is because, with the basil API and newer, Payment Intents are no longer directly linked to Invoices

tender sequoia
#

Okay, and how can i retrieve the subscription id in charge.refunded

gaunt fern
#

If you want to go from a Payment Intent to it's related Inovice, you need to use the Invoice Payments list API

tender sequoia
#

I just need to update a referral based on subscription id when user refunds

gaunt fern
tender sequoia
#

but subscriptionId is not on charge.refunded and on last API i was getting it through invoice

gaunt fern
#

You need to filter this list API using the Payment Intent ID to get to the Invoice and from there you can get the Subscription

tender sequoia
#

const invoicePayments = await stripe.invoicePayments.list({
payment: {
payment_intent: 'the payment intent id'
}
});

like this?

i will get only one invoice right? array of 1 object

#

if i don't send invoice id it's not required right?

gaunt fern
#

In Python this would look like

invoice_payments = stripe.InvoicePayment.list(
    payment={
      "type": "payment_intent",
      "payment_intent": "pi_XXXXXXXX" # <= this is where you put the ID
  }
)
tender sequoia
#

nice, and i will only one invoice object in that array in the response right?

gaunt fern
#

Yes, One invoice can be related to multiple Payment Intents but each Payment Intent will be related to 1 or 0 Invoices

#

But since this list API needs to work both ways (Invoice => Payment Intents, Payment Intents => Invoice), we always return a list

tender sequoia
#

nice, give me 1 minute to try it

#

I got the subscription id from invoice.parent now. All good

#

Thank you very much!

#

This basil new api requires you to do a lot of stripe calls

#

i hope it won't be an issue on the rate limiter to stripe

#

if an app has a lot of users, talking in general i mean

#

Do you know the limit of the rate limiter on the stripe API, just curious

#

I mean even for invoice.paid, i had to do some extra calls to get the payment_intent on new Basil Api, and before i was getting it on the event

gaunt fern
#

And yeah, the basil API does wind up causing more API requests

tender sequoia
#

100 requests per second, above that i hope it queues. I will read the documentation. Thank you

bold fieldBOT