#mvhirsch
1 messages ยท Page 1 of 1 (latest)
Hello ๐
Not sure I completely understand the question. Do you have an example you can share so that I'm on the same page? Like do you want to retrieve all the checkout sessions in let's say last few months?
In which case, you can just retrieve all the checkout sessions created on your account using the List Checkout Session API endpoint
https://stripe.com/docs/api/checkout/sessions/list?lang=node
You don't really need to retrieve the events for each
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
yeah, I know about that. I even tried it before. Problem is: I can't tell when the user payed. It's just when the user created that session.
Technically, checkout.session.completed timestamp only reflects when a checkout session was completed, not when the customer was actually charged and when the payment succeeded.
I know, it's more complex. How could I retrieve the paid at for every session, then?
hmm thinking..
Would it be possible to retrieve such a timestamp iterating through all Charges (only taking account paid: true)?
I was thinking about that but a charge would only have created timestamp not when it succeeded. Also, There's an easier way to get to the latest charge from a checkout session rather than listing all charges.
A checkout session would have a PaymentIntent that you can expand
https://stripe.com/docs/expand
Then on the PaymentIntent, you can look at the latest_charge
https://stripe.com/docs/api/payment_intents/object?lang=node#payment_intent_object-latest_charge
Which should get you to the most recent charge for that transaction
(You'd need to expand that as well)
I see. That would ease the mapping of my and stripes data. But still I only get some created timestamps?
Is there a possibility that a created-timestamp of a charge and a paid-at-timestamp would not be within 24 hours?
It is possible in case a delayed payment method such as ACH is used.
The other option might be to generate a report to look at when the charges were settlted
(Just a heads up, our team on discord don't know much about reporting API as such)
https://stripe.com/docs/reports/select-a-report
https://stripe.com/docs/reports/report-types
currently I only use these payment_method_types: card, giropay, sofort, sepa_debit. I think sofort would be a delayed payment. isn't it?
Yup it is
damn ๐
okay, thank you very much! I'm still not sure how I can solve my problem, but I feel enlightened (and will take a look in the reporting API).
NP! ๐ Sorry couldn't help much
Let us know if you have any follow ups