#emmanndev

1 messages · Page 1 of 1 (latest)

manic masonBOT
heavy hornet
#

HellO!

fiery whale
#

Hi there

heavy hornet
#

This is a checkout session that was created on your connected account right? If so, you need to be passing in the Stripe-Account header when you retrieve it

fiery whale
#

yes the ssion was created payment was successfull and get redirected to success page, also i can see when webhook fired the entire session

#

but just can't retrieve line_items to create order

heavy hornet
#

That's likely what you're missing

fiery whale
#

oww it might be

#

let me check it out. thank you so much

fiery whale
# heavy hornet That's likely what you're missing

One question 'im not using payment intent, i'm using "stripe.checkout.sessions.create " with direct charges in the connected acount, the connected account which is a standard account that receive the money, i don't have problem on that side. However how should i handle it properly with checkout session, retrieving line_items plz.

heavy hornet
#

Yeah you'd still solve it the same way - you'd use the Stripe-Account header in your request

#

The link I sent is just an example showing how you'd set the header, you can apply that to any stripe request you make

#

You should be already doing the same thing when you create the checokut session

fiery whale
#

I mean it's not really clear you are talking about const sig = req.headers['stripe-signature']? Or explain me better plz

heavy hornet
#

Okay let's back up for a second - in that link I sent you, you can see this example

const paymentIntent = await stripe.paymentIntents.create(
  {
    amount: 1000,
    currency: 'usd',
    automatic_payment_methods: {
      enabled: true,
    },
  },
  {
    stripeAccount: '{{CONNECTED_ACCOUNT_ID}}',
  }
);

The part that you should be adding on to your request is this:

  {
    stripeAccount: '{{CONNECTED_ACCOUNT_ID}}',
  }
fiery whale
#

i've done this with checkout session

#

but it's not working when retrieving line_items

#

it says this: StripeInvalidRequestError: No such checkout session

heavy hornet
#

What does your retrieving line items code look like now, after adding that in?

fiery whale
#

instead of retrieving line_items: StripeInvalidRequestError: No such checkout session: 'cs_test_a1NBo9D9S2rrgDRkBCOd78ldAnBsoEtjnkJsiuouNsP5cZCul72dSxkklA'

#

const items = await stripe.checkout.sessions.listLineItems(event.data.object.id);
console.log('items', items);

#

and i did it other way too: const sessionWithLineItems = await stripe.checkout.sessions.retrieve(
event.data.object.id,
{
expand: ['line_items'],
}
);

#

none of this worked

heavy hornet
#

That code doesn't pass in stripeAccount right? Like I mentioned, you need to start passing that in.

fiery whale
#

it has it, because when doing checkout session we can see which vendor the money is going to

#

you get it?

#

so i think it's not about the stripeAccount

heavy hornet
#

It's definitely about the stripeAccount - to break it down, you're making requests with your platform API key. SInce you're doing that, we'll only look at objects that belong to your platform account.

However, you created the checkout session on a connected account which means it belongs to that account and not on the platform. If you want to retrieve that checkout session belonging to your connected account using your platform API keys, you have to specify the stripeAccount in order to tell us which account to make the request on instead

#

In other words - you passed in the stripeAccount when creating the Checkout Session, so you HAVE to pass it in when you retrieve it as well

fiery whale
#

ok thank you i'll check again