#roshe10_best-practices

1 messages ยท Page 1 of 1 (latest)

twin iceBOT
#

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

main portal
#

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.

noble ridge
#

I just need the name of the item that was included in that payment, like to know what user has paid for

main portal
#

is this for subscription payments, or one time payments?

noble ridge
#

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

main portal
#

for one time payments, what do you use for the actual payment? an Invoice? a Checkout Session? something else?

noble ridge
#

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)

main portal
noble ridge
#

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 ?

main portal
#

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
noble ridge
#

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 ?

main portal
#

I was talking about one time payments here.

#

for Subscriptions, the simplest option is to list Invoices

noble ridge
#

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 ?

main portal
#

yes makes sense.

noble ridge
#

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

main portal
#

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
noble ridge
#

In that prebuil report, it's the same issue, I have no item name for recurring payments

main portal
#

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.

noble ridge
main portal
#
  • to find the associated Invoice, it depends. which API version are you using?
noble ridge
#

v81, but can upgrade if needed

main portal
#

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

noble ridge
#

2024-10-28.acacia AP

#

cs_test_a1iGbIc2HviyChNrKsVILJHbugWDVaMZuJ1281tI5UT51WOzkYpwC9ohEz

twin iceBOT
main portal
#

got it. then the PaymentIntent should directly contain an invoice property

noble ridge
#

I see it's removed in newer versions, what if I upgrade, can I find retrieve it similarly to checkout session you suggested wit

last moth
#

๐Ÿ‘‹ Hey, taking over here, just taking a look