skip to Main Content

I am using php and have stripe main account, with some connected accounts.
On those accounts I created payment links and I could add a redirect link (after completing payment), in which I added the placeholder for the session_id (automatically added).

The success page I created should get the checkout session, but somehow I am unable to get it from the connected accounts.

I can’t find in the stripe docs how to do that, only from the main account (session_id)

Does anybody know howto and have some good docs?

I got an error:

The resource ID cannot be null or whitespace

This is code I use:

$stripe = new StripeStripeClient('sk_live_......');

$acc = $stripe->accounts->retrieve('acct_.....', []); // This shows some data of that connected account.

$session = $stripe->checkout->sessions->retrieve($_GET['session_id'], [], ['stripe_account' => 'acct_....']);  

the session_id in the url is correct (as I see it on the dashboard of stripe), but as I do not get any data from the connected account regarding any payments, its hard to find it.

I am pretty new with this, so any guidence would help.

Extra update

I changed the following line and got also info of the session (id, amount, email who paid, etc):

$session = $stripe->checkout->sessions->retrieve($_GET['session_id'],['expand' => ['payment_intent']], ['stripe_account' => 'acct_.....']);

The only error I am getting is:

Fatal error: Uncaught StripeExceptionInvalidArgumentException: The resource ID cannot be null or whitespace

No idea why I still get that error or what I miss.

2

Answers


  1. Chosen as BEST ANSWER

    I seem to have fix it, using the following line:

    $session = $stripe->checkout->sessions->retrieve($_GET['session_id'],['expand' => ['payment_intent']], ['stripe_account' => $account_id]);
    

    The $account_id changes depending on the account.

    But adding the expand part made it show the session_id from the connected stripe_account.


  2. It’s hard to say for sure without more details, but it sounds like you’re trying to access objects on the connected account from your platform account. If I’m right, you’re likely seeing errors about those objects not existing. If that’s what’s happening you need to make a Connect request to fetch the objects from your connected account.

    If that’s not what’s happening please edit your question and add more detail, including the specific code and error messages you’re seeing.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search