#luc_invoice-paymentintent-charges
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/1263237589083619481
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi ๐
The relationship goes like this: Invoice -> Payment Intent -> Charges
So to get the related Charges for an Invoice you follow this relationship
- From Invoice, get the Payment intent: https://docs.stripe.com/api/invoices/object#invoice_object-payment_intent
- For the Payment Intent, get the related Charge. If you only want the successful one you can use the
payment_intent.latest_chargeproperty: https://docs.stripe.com/api/payment_intents/object#payment_intent_object-latest_charge, or you can filter Charges by Payment Intent https://docs.stripe.com/api/charges/list#list_charges-payment_intent
If all you want is the latest_charge, you can get all this data in a single API call by passing expand=[payment_intent.latest_charge'] when you retrieve the Invoice.
https://docs.stripe.com/expand
thank you! one last question, can an invoice be related to more than 1 charge?
Yes. If the customer attempts a payment and it fails that will generate a charge. Then, if the customer attempts to pay again and it succeeds that will generate another charge.
I mean, "to more than one successful charge"**
Ah, no