#xfechx

1 messages · Page 1 of 1 (latest)

old haloBOT
worthy iris
#

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)

stone cape
#

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

worthy iris
#

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

stone cape
#

Which programming language are you using?

worthy iris
#

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

stone cape
#

Is that the source_transaction?

worthy iris
#

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:

#
old haloBOT
rain canopy
#

Hello! I'm taking over and catching up...

worthy iris
#

I cannot see the error

#

in the account where I am making the request from?

rain canopy
#

If you can't see the error how do you know you're getting an error?

worthy iris
#

Developers >> Logs?

#

The code is catching it and it is giving me a message

rain canopy
#

Okay, the request ID should be in there.

worthy iris
worthy iris
#

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"];```
rain canopy
#

Did you run that?

worthy iris
#

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.```
rain canopy
#

What is the ID of your platform account?

#

The one that secret key belongs to?

worthy iris
#

sorry

#

one moment

#

acct_17QCgDChCzTFj30F

rain canopy
#

Looks like that account is no longer connected to your platform, so the error you're getting is accurate and expected.

worthy iris
#

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

rain canopy
#

You can't, they're no longer connected, so you don't have any access to their current info.

worthy iris
#

OK

#

So I do need to catch those cases

rain canopy
#

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.

worthy iris
#

I already have it wrapped in try, catch, but I don't know how to get the exception it belongs to..

#

InvalidRequest

rain canopy
#

What do you mean? What do you see if you var_dump the exception?

worthy iris
#

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.

rain canopy
#

So the code is account_invalid which you should be able to key off of.

worthy iris
#
      //...
    }```
#

like above?

rain canopy
#

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.

worthy iris
#

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?

rain canopy
#

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.

worthy iris
#

sure , but not anything related to the stripe API....

rain canopy
#

No.

worthy iris
#

can I prevent this?

rain canopy
#

Prevent what?

worthy iris
#

there is no function to first try if an account has access to another account , without having to catch an error?

rain canopy
#

No. You could keep track of which accounts disconnect from your platform and avoid making API requests on those accounts though.

worthy iris
#

This is from a parent account, can that be tracked as a connected-account?

rain canopy
#

Not sure I understand, can you clarify?

worthy iris
#

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

rain canopy
worthy iris
#

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.

rain canopy
#

So you're both?

worthy iris
#

sure

#

in this case no

rain canopy
#

So you can get those Events and avoid making API requests for disconnected accounts.

worthy iris
#

I think you are not understanding me, sorry.

rain canopy
#

The API request in question is being made with the platform's API key, correct?

worthy iris
#

This is a connected account

#

but the request is made as a platform

#

yes

rain canopy
#

Yeah, you're trying to make an API request that involves a connected account, but the API request is being made by your platform.

worthy iris
#

because those balance transactions, are from payments made to the account

#

when it was connected to that OTHER platform

rain canopy
#

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).

worthy iris
#

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.

rain canopy
#

Can you give me a request ID showing an example of one of these requests?

worthy iris
#

sure, but i can't find the request id yet

rain canopy
#

Can you give me the request ID of a successful request?

#

Just so I can get an idea of what's happening?

worthy iris
#

req_1cx4Wz9KaHDOfc

rain canopy
#

That's a request to fetch balance transactions. Connect is not involved, no other accounts are involved.

#

There must be a different request?

worthy iris
#

it is the only call to the stripe api I am making

rain canopy
#

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?

worthy iris
#

sorry

#

it's this one:

#

$stripe->accounts->retrieve($payment->source->source->id, []);

#

I am trying this:

#
#

but getting the error, before it can give me the request id?

rain canopy
#

Yeah, so that's a request to fetch an account. Can you give me the request ID of a successful version of that request?

old haloBOT
worthy iris
#

I can't find it

rain canopy
#

Can you run the code that logs the request ID in a scenario where the request will succeed?

worthy iris
#

yes, trying that

#

req_u3Lj4FxX6FmoxQ

tacit pendant
#

👋 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?

worthy iris
#

a disconnected parent account

tacit pendant
#

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?

worthy iris
#

perhaps that is the case in some scenarios...

tacit pendant
#

Mostly though you should always think of Connect as a one-way path. It is always going to be the "parent" accessing the "child".

worthy iris
#

ok, so connected accounts cannot retrieve anything related to account properties of the transfer the payment came through?

tacit pendant
#

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.

worthy iris
#

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.

tacit pendant
#

No you can't retrieve details of the Platform. It just identifies the Platform.

tacit pendant
#

Otherwise you would have to generate something like that from the Platform

worthy iris
#

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

tacit pendant
#

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.

worthy iris
#

ok

#

I think it's all . Thanks for your help