#ironbeard_api
1 messages ยท Page 1 of 1 (latest)
๐ 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/1493321385781624936
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
(previously I could just get the PI id from latest_invoice.payment_intent
Hello! If you're trying to get the PaymentIntent from the latest_invoice and using API version 2025-03-31.basil or newer, then yes you'll need to look at the payments property as demonstrated here: https://docs.stripe.com/changelog/basil/2025-03-31/add-support-for-multiple-partial-payments-on-invoices#inspect-the-array-for-payment-information
Gotcha! So if someone uses a PromotionCode / Coupon that results in no payment necessary, will latest_invoice.payments.data be empty?
or will latest_invoice.payments be Falsey?
Since no PaymentIntent is created, latest_invoice.payments will be empty ๐
And when I confirm the PaymentIntent, is there a way to expand the related Invoice to be included in the response?
No, you'd have to use the list Invoice Payments endpoint: https://docs.stripe.com/changelog/basil/2025-03-31/add-support-for-multiple-partial-payments-on-invoices#use-the-new-for-payments-and-invoice-connection
However, you should already have the latest_invoice from the subscription, right?
Yes, but the latest_invoice will have a different status (open) than after I confirm the PaymentIntent, right? I know I can wait for webhooks to send the invoice_updated event, but I was hoping to just grab the latest one at the same time as confirming
I suppose I could retrieve the invoice using latest_invoice, but was just hoping to reduce API calls
Ah I see, unfortunately you'll need to listen for the event or make an extra call since the Invoice isn't directly linked to the PaymentIntent anymore ๐
Gotcha, thanks ๐ BTW, is there a way to only listen for invoice events that aren't associated with subscription creation? e.g. I only want webhooks if a subscription is being renewed etc. Or do I just filter that on my end?
You'll receive all invoice.updated events, but you can look at billing_reason to see if the Invoice is from subscription creation! https://docs.stripe.com/api/invoices/object#invoice_object-billing_reason
Great, thanks ๐