'Retrieving Stripe Session Object on a Connected Account in Node

Looking for advice on how to retrieve a checkout session object in Stripe associated with a connected account using Node.

Retrieving a session object is simple for sessions tied to my own account:

var stripeSession = {STRIPE_SESSION_ID}
const session = await stripe.checkout.sessions.retrieve(stripeSession);

But I'm not seeing any documentation how how to retrieve a session associated with a connected account. I think the solution has something to do with this: https://stripe.com/docs/connect/authentication, but unclear on how to re-structure the retrieve method.

For instance, trying:

    // Session ID
    var stripeSession = req.query.stripesession;

    const session = await stripe.checkout.sessions.retrieve(
        {session: stripeSession},
        {stripeAccount: "ACCOUNT_VALUE"});

Is yielding an error of "Argument "session" must be a string, but got: [object Object]"

Thanks in advance for any help!



Solution 1:[1]

Looks like it was simple...


// Find the stripe session
const session = await stripe.checkout.sessions.retrieve(
  "SESSION_ID", {stripeAccount: "ACCOUNT_ID"}
);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ahmed Haque