#skam_payouts-php
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1252656935308623953
๐ Have more to share? Add details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- skam_payouts-php, 23 minutes ago, 70 messages
skam_payouts-php
i just saw your message in #dev-help , but i can't reply there. I am not getting any payment intents... how can i retrieve those? thanks in advance
What are you getting exactly?
(and sorry, I replied in the wrong channel that's my bad)
no problem, I am not sure if my method is the correct one... from my code i am trying to loop over a conencted account's payouts, and from those determine which payment intents originate from them, since those have metadata set for a database id in our server...
all good I understand all that. I am teaching you to fish ๐
A BalanceTransaction object is documented here: https://docs.stripe.com/api/balance_transactions/object it has an id such as txn_123456 and many properties. Right now your code is expanding the source property. That's an id to another object such as a Charge ch_123 or a Refund re_123. Since you are already expanding it you are getting that object right? So the first step is to look at that and understand what you get back
ah sorry for being ignorant haha, i am trying my best from the documentation, the issue is that i am using legacy syntax, so i am finding it hard to navigate the docs ๐
from the expanded data.source i am indeed getting a payment_intent, but it is null for all recods returned with my shared code, but the payment intents are indeed not null, since I find them linked via the stripe dashboard... am i missing osmething?
yeah sorry you are going a bit too fast and losing yourself that's why
data.source is a Charge object right? It will have an id such as ch_123 or py_123 is that correct? Can you give me an example of those ids?
py_1PDnNtGazIDf4gzF9LmFEHRB
Okay does that exist in your account?
i am checking, gimme a sec ๐
sure thing. I swear you'll get there in a few minutes with hopefully a real understanding of what's happening!
okay, thank you for trying to better my understanding for further use ๐ looking at the payment in the dashboard, it has account, transfer, fee, payout ids
yeah sorry you are already jumping multiple steps ahead ๐
okay, well i am at the payment now
yeah but you're also multiple steps ahead still. you're trying to read past my questions
All good, that's not working I'll just give you the answer
sorry if i got ahead of myself, i was merely trying to do my best
If you look at https://docs.stripe.com/connect/destination-charges?platform=web&ui=stripe-hosted#flow-of-funds-app-fee you can see the flow of a funds of a Destination Charge which is what you are using. It shows all the objects involved and where they live exactly.
Right now you are listing BalanceTransactions on the connected account. So what you are getting is the txn_003 and py_001 on the right in that picture.
What you want though is the Charge ch_001 and its PaymentIntent pi_001 on the left in that picture.
So you have to expand back up to the platform's information.
BalanceTransaction txn_003 -> source -> Charge py_003 -> source_transfer -> Transfer tr_001 -> source_transaction -> Charge ch_001 -> payment_intent -> PaymentIntent pi_001
So you have to expand data.source.source_transfer.source_transaction.payment_intent to go back up to the full PaymentIntent.
Sadly you can not expand more than 4 levels and that would make 5 so it's impossible to go back up to the original PaymentIntent. But the Charge ch_001 will have the same metadata so that should be fine. So just try
expand: ['data.source.source_transfer.source_transaction'] and that will give you the Charge you want
i understand why you preferred to let me work it out, that was quite the message - but very thorough and to the point, so thank you for taking the time to elaborate
also earlier in the other thread you seemed to think we weren't returning JSON and you're right but we return real PHP objects. You don't need the array notation
You can do $payouts->data[0]->source->id for example
Also I am a PHP developer myself and I have a function to "dump" Stripe objects in a pretty-printed fashion that I think will help you better understand what you are getting back function stripeDump($obj, $extraString = "") { echo "$extraString<br><pre>\n" . json_encode($obj, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES) . "\n</pre><br>"; }
And so for example you can do this:
$stripePayouts = \Stripe\Payout::all(
[
'limit' => 50
],
['stripe_account' => $business_stripe_account_id]
);
stripeDump($stripePayouts);``` and _see_ the real JSON our API was returning.
It makes it much easier to debug things like what we were talking about