#roshe10_best-practices
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/1443533074192400556
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
hi there!
you can't find this information ont eh Charge/PaymentIntent obejct directly. but you can find it on the Invoice object or Subscription or Checkout Session, depending on the information you want.
I just need the name of the item that was included in that payment, like to know what user has paid for
is this for subscription payments, or one time payments?
I need for both in the same list, so let's say I need for this month to see which payments happened and what was the name of them.
11-01-25 | $10 | pi_ID | status=successful | name_of_the_paid_item
for one time payments, what do you use for the actual payment? an Invoice? a Checkout Session? something else?
couple of things across the system, there is checkout session, embedded checkout, and payment links
(same goes for initial subcription, then they just been automatically collected)
got it. then for one time payments, you'll need to make extra API calls to get back the associated Checkout Session, using this: https://docs.stripe.com/api/checkout/sessions/list. Make sure to use expand: ['line_items'] in your API call to retreive the list of Price/Products that were bought.
if you are not familiar with expand, you can learn more about it here: https://docs.stripe.com/expand
hmm, but what should be my main/initial API call, in order to get unique payments for time period, and then go through some loop and call additional APIs in order to expand my data.
If I need to call checkout sessions and also async call charges/payment_intents without correlation between the two, I would have duplicates without knowing which is what. Not sure if I understood it right ?
but what should be my main/initial API call, in order to get unique payments for time period,
- the simplest option would be to directly list all Checkout Session that succeeded, and from there you can directly get all the information you need.
- or you could start with PaymentIntent IDs, and then for each ID make an extra API call to retrive the corresponding Checkout Session ID
if I go the first way, It won't include my subscription update payments for that period, right ?
so I have to go the second way ?
I was talking about one time payments here.
for Subscriptions, the simplest option is to list Invoices
yes, but in checkout session list it will already include initial subcription payment (if there is one for that period) so If I additionaly list inovices, I will have some duplicates, unless I can filter out somehow in checkout those initial subsctipion payments,
while in payment intents it will include everything one off, initial sub payment, updated sub payment ?
yes makes sense.
also are you aware that Stripe has a lot of built in reporting you could use for this? https://docs.stripe.com/stripe-reports
it just feels strange that for this simple task, there is no simple solution, where I just need amount, date, name of the paid item for any transaction, no matter whether is one-off, recuringg, donation, product whatever
you can do what you describe:
- list all PaymentIntents
- then for each PaymentIntent, make extra API call to either retrive the associated Invoice or Checkout Session, which will contain the infro you want
In that prebuil report, it's the same issue, I have no item name for recurring payments
maybe, we on Discord are not familiar with the content of the reports.
I agree it's not straightforward, but what I suggested above will work (list PaymentIntent then retrive the associated objects).
or, when listing Checkout Session, filter out all Session that have mode: subscription, to only get one time payments. and for the recurring payments, list all invoices.
I like your suggested way with payment intents, just not sure how can I get associated invoice or checkout session from payment intent object: https://docs.stripe.com/api/payment_intents/object?api-version=2025-11-17.preview If you could help me with that, I don't see related checkout_id or invoice_id here
sure:
- to find the associated Checkout Session, use this endpoint while setting the
payment_intentproperty: https://docs.stripe.com/api/checkout/sessions/list
- to find the associated Invoice, it depends. which API version are you using?
v81, but can upgrade if needed
sorry I meant the Stripe API version.
if youa re not sure, feel free to share a specific Checkout Session ID (cs_xxx) you created and I can check on my end
2024-10-28.acacia AP
cs_test_a1iGbIc2HviyChNrKsVILJHbugWDVaMZuJ1281tI5UT51WOzkYpwC9ohEz
got it. then the PaymentIntent should directly contain an invoice property
I see it's removed in newer versions, what if I upgrade, can I find retrieve it similarly to checkout session you suggested wit
๐ Hey, taking over here, just taking a look
For newer versions, you can get the Invoice for a Payment Intent with a call like this: 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