#xfechx
1 messages · Page 1 of 1 (latest)
my code brings a list of the balance transactions which type has been transfers from a platform to the current account. But there is not much info in the payment type (when it is from a transfer)
Yeah because the information is on the PaymentIntent object, which resides in the Platform. You would want to find this original PaymentIntent from the Transfer
Expand this source_transfer https://stripe.com/docs/api/transfers/object?lang=node#transfer_object-source_transaction
I always have trouble with expanding, could you please give me an example using it?
I am specifically looking for a Name (perhaps business name, or owner of account name), and an address
Which programming language are you using?
PHP
hey, but little detail...
all of the payment_intent are null
"order": null,
"outcome": null,
"paid": true,
"payment_intent": null,
"payment_method": null,
"payment_method_details": {
"stripe_account": [],
"type": "stripe_account"
},
"receipt_email": null,
"receipt_number": null,
"receipt_url": ```
most of it is null
Is that the source_transaction?
yes
it is a balance transaction from a transfer payment
it has source->application and source->id
and metadata
but I need more info about the platform, to get a name and address
I had this, but comes up with a stripe error about not having access or it may have been revoked:
$stripe_account_name = $stripe_account->business_name;
if(empty($stripe_account_name)){
$stripe_account_name = $stripe_account->display_name;
}
$stripe_account_email = $stripe_account->email;
$stripe_account_address = $stripe_account->support_address;```
Hello! I'm taking over and catching up...
Can you give me the request ID showing the error you're talking about above? Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
If you can't see the error how do you know you're getting an error?
Okay, the request ID should be in there.
You can get the request ID using your code as well: https://stripe.com/docs/api/request_ids
cannot find it here..
ok one moment please
like this?
'created' => [
'gte' => strtotime($startDate),
'lt' => strtotime($endDate) + 86400 // Add 1 day to include payments on the end date
],
'limit' => 100,
expand => [
'data.source.customer',
'data.source.payment_intent',
'data.source.invoice',
]
], $connected_account
);
echo $balance_transaction->getLastResponse()->headers["Request-Id"];```
Did you run that?
not getting anything?
The provided key 'sk_live_*********************************************************************************************ejmdf9' does not have access to account 'acct_1EhCpnKRfF1il8EF' (or that account does not exist). Application access may have been revoked.```
Looks like that account is no longer connected to your platform, so the error you're getting is accurate and expected.
ok..
But my question again, is how can I obtain name, address from the account that made the transfer to the platform acct_17QCgDChCzTFj30F
and also, how can I catch that specific error (what type is it)? So that I can execute other code instead, because this error is only a batch of data, it doesn't happen always
You can't, they're no longer connected, so you don't have any access to their current info.
If you wrap the request code in a try...catch you should be able to examine the exception to get specific details about how to handle it.
I already have it wrapped in try, catch, but I don't know how to get the exception it belongs to..
InvalidRequest
What do you mean? What do you see if you var_dump the exception?
nothing so far
one moment
Stripe\Exception\PermissionException Object ( [error:protected] => Stripe\ErrorObject Object ( [charge] => [code] => account_invalid [decline_code] => [doc_url] => https://stripe.com/docs/error-codes/account-invalid [message] => The provided key 'sk_live_*********************************************************************************************ejmdf9' does not have access to account 'acct_1EhCpnKRfF1il8EF' (or that account does not exist). Application access may have been revoked.
So the code is account_invalid which you should be able to key off of.
I can't validate your code for you. I recommend you try running this code to determine if it works as you expect or not.
ok.
thanks for your help
with
the info that i cannot get
I would need to re-connect the account, correct?
so this info is for tax purposes, but if the 'parent' account has disconnected, etc. then we cannot retrieve the data, and we have to manually add it?
or what can a workaround be?
That's up to you. You could contact the business for that info, you could record that information before they disconnect, lots of different appoaches.
sure , but not anything related to the stripe API....
No.
can I prevent this?
Prevent what?
there is no function to first try if an account has access to another account , without having to catch an error?
No. You could keep track of which accounts disconnect from your platform and avoid making API requests on those accounts though.
This is from a parent account, can that be tracked as a connected-account?
Not sure I understand, can you clarify?
the account where we want to get the data is a platform. But those transfers are from a platform sent to the platform from where we are making those api calls
Your platform will get an account.application.deauthorized Event when a connected account disconnects: https://stripe.com/docs/api/events/types#event_types-account.application.deauthorized
this is the other way around
we are in a connected account
not a platform
in this scenario
the api request is made as a platform though.
but it is a payment (transfer) sent from a 'parent' account.
So you're both?
So you can get those Events and avoid making API requests for disconnected accounts.
I think you are not understanding me, sorry.
The API request in question is being made with the platform's API key, correct?
Yeah, you're trying to make an API request that involves a connected account, but the API request is being made by your platform.
because those balance transactions, are from payments made to the account
when it was connected to that OTHER platform
So your platform receives the account.application.deauthorized Events I mentioned above, and can thus keep track of which connected accounts get disconnected, and can thus avoid making API requests that involve those disconnected accounts (i.e., API requests you know will fail because the connected account is no longer connected).
you are still not understanding me
ok, so can we talk parent and child example
this account (where we make the api call to get balance transactions), is a child of a parent account which transfered those payments.
the child account, wants to get info about the transfer payments made from the parent, but parent is disconnected.
that is the scenario
when child tries to access $stripe->accounts->retrieve($payment->source->account, []); that is when the exception is catched.
We need to be able to retrieve data about who the parent was, but there is none.
Can you give me a request ID showing an example of one of these requests?
sure, but i can't find the request id yet
Can you give me the request ID of a successful request?
Just so I can get an idea of what's happening?
req_1cx4Wz9KaHDOfc
That's a request to fetch balance transactions. Connect is not involved, no other accounts are involved.
There must be a different request?
it is the only call to the stripe api I am making
Earlier you shared this code:
$stripe_account = $stripe->accounts->retrieve($payment->source->source->id, []);
That would be a completely different API request.
Is that the code/request that's throwing the error?
sorry
it's this one:
$stripe->accounts->retrieve($payment->source->source->id, []);
I am trying this:
echo $stripe_account->getLastResponse()->headers["Request-Id"];```
but getting the error, before it can give me the request id?
Yeah, so that's a request to fetch an account. Can you give me the request ID of a successful version of that request?
I can't find it
Can you run the code that logs the request ID in a scenario where the request will succeed?
👋 stepping in as Rubeus had to step away
Okay so sounds like you are hitting an error when attempting to retrieve a disconnected Connected Account?
a disconnected parent account
Not sure what that means. You can't retrieve parent accounts from a Connected Account
It is possible that you have two Standard Connected Accounts which are both connected to each other. Then that would technically be possible but it would still always be the "parent" retrieving the "child". Is that what you mean?
perhaps that is the case in some scenarios...
Mostly though you should always think of Connect as a one-way path. It is always going to be the "parent" accessing the "child".
ok, so connected accounts cannot retrieve anything related to account properties of the transfer the payment came through?
Standard Connected Accounts can only retrieve the objects that are on their own account
(Edited to make more clear)
Those objects will contain an application
Which will indicate who the related platform is.
yes
one second please
with application property, can we retrieve details of the Platform?
as a Platform API call?
Because an account needs to generate documents from balance transactions and those balance transactions include transfers from a Platfom to it.
No you can't retrieve details of the Platform. It just identifies the Platform.
To do this the Connected Account retrieves the payments on their account.
Otherwise you would have to generate something like that from the Platform
yes, the balance_transactions are retrieved, and there you can see that those payments are from transfers. My problem is that there is not enough info (like business name and business address) to retrieve
in each balance transaction the info is source->application and metadata but nothing else
everything else is null
Yeah you would need to know that information about the platform already. Otherwise, you could do something like set metadata with that information on the Payment after the Transfer occurs.