#todordvv_docs
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/1293557469196451881
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
hi there!
hello!
the list PaymentIntent is probably what you want: https://docs.stripe.com/api/payment_intents/create
and make sure to use the Stripe-Account header to only see payment that happened on a specific connected account: https://stripe.com/docs/connect/authentication
so to clarify
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
this is the API endpoint
yes, sorry
and i just add a second parameter to the function list()
sorry
function ->all()
so something like $stripe->paymentIntents->all($args, ['stripe_account' => '{{CONNECTED_ACCOUNT_ID}}']);
?
yes, that looks correct to me. but make sure to try the code in test mode.
okay will do, one more thing
is payment intents better than charges? i.e. do they contain all the data I would need like whether the transaction was a success and also the filtering by date range?
or could I use the charges API endpoints in the same way by specifying the account header?
both can work, it depends on your integration. but assuming your itegration doesn't use some old APIs, we recommend PaymentIntents.
do they contain all the data I would need like whether the transaction was a success and also the filtering by date range?
yes
connected accounts use the stripe dashboard to charge clients
we just wanna group this into a tool on our server dashboard that shows how much money they made each week
for reporting purposes
I'll try with Payment Intents and reach out again if I encounter any more issues. Thank you!
oh one last thing
the client expressed concerns about something about charge dates
i.e. they said sometimes a payment was pending or being processed for a few days
and then they said it's listed in the Payments screen based on date completed if I recall correctly
but in the details for the payment it showed the date it was issued/created
I would need a specific example. can you share the PaymentIntent ID (pi_xxx)?
i'll ask and reach out again
but I think their concern was if we list all the payments for last week for example
but we filter out any incomplete payments
then when the payment completes it would change the amount for last week
yep that's true
so I guess I am wondering if there's a way to order payments by date completed
so that we can include them in the week they completed
that way reports wont change based on pending payments
i.e. filter a date range based on date the charge/payment completed
or do we maybe use the Invoice objects? are invoices created only on payment success?
Hi taking over here
thank you
That depends on the flow you're using
Do you have a sample Invoice id I can check?
in_1Q6ldyHtb0ai3wxlNOw6Y7eD
how about this one?
so the concern is that sometimes the date a payment was created is not the same date the payment completed, i.e. funds were charged
but we don't want to assume the charge will complete, and we don't want to retroactively change the amounts for a past week
but we do wanna show an accurate sum total on a weekly basis, which I presume should include all payments that completed successfully in that week, not payments that were created that week
because some may have been created in previous weeks but completed in the last week - hope I'm making sense here
so that's why I'm thinking - if the "CHARGES" objects are only created when there's an attempt to move money, and if they succeed they probably always have the same created and completed date? or am I assuming incorrectly
Yeah that makes sense. Unfortunately there's not a simple way to filter that via the api at all. I recommend listening for invoice.paid or payment_intent.succeeded events on your connect accounts instead, and recording the timestamp and invoice or payment intent id in your database so that you can do a database query for this instead
That is a good idea but would not work for past invoices/payments.
This also depends on the flow
Are you only doing subscription payments?
I can ask but I think there also may be one time payments
Would need an example because the behavior depends on the flow
and to clarify
does this payment succeeded date = charge created date?
or where is it stored in api objects?
because I'm trying to figure out where some of this data is in the various objects
because an alternative would be for us to get the payments from 2 months back (which I think would be ample amount of leeway for making sure all payments in that time were completed) and then just group by this completed date
(in code)
yes, but if payment fails and there's retries, for example, there could be multiple charges
So you'd also want to only look at succeeded charges if doing it this way
yes that was my intention to only count successful charges anyway
Really I recommend going with this approach: I recommend listening for invoice.paid or payment_intent.succeeded events on your connect accounts instead, and recording the timestamp and invoice or payment intent id in your database so that you can do a database query for this instead
and then group them into week segments
I see
in the case where I listen for webhook data, is the account ID included in the headers sent to our server?
okay I will bring this up with the client and figure out what to do, but just to be clear
if they do insist on API endpoint data collection, we COULD in theory use the charges endpoint and filter by successful charges and group by charge date created
ofc we would mind the API rate limits, I read it's 100 per second at most, I could limit it to a few per second in Javascript
Have you looked into reporting?
https://docs.stripe.com/stripe-reports
I have not but if it can accomplish what I need then sure
is there an api reference for this because I searched the reference for reports and I don't think I found any
also it seems this generates files whereas we need the raw data
You can read from the file programatically, no?
๐
thank you so much!
will focus on reporting first then
the report run object says it can take a connected account parameter
but when I try it I get an exception
req id: req_A2XFC31WOUdAsg
hmm I guess I should use connected_account_balance.summary.1 for type
or some of these?
Yup
which one corresponds to payments?
is it connected_account_balance_change_from_activity or is it connected_account_payouts
I'm not sure, my team won't know much specifics about reporting types. You can try these out in test mode or reach out to our support team as they're experts on this
https://support.stripe.com/?contact=true
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
okay one last thing for now
how do I retrieve the CSV file
i tried a few different things but none seem to work
I do get a response for the report run like so:
and there is a file object in the response
then I tried using this api:
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
but I don't know what the "path to file" is supposed to be
We have docs for this: https://docs.stripe.com/reports/api#report-runs