#Drewdan-connect
1 messages ยท Page 1 of 1 (latest)
client side, I am using the PHP client
so I pass a second array with ['stripe_account', 'acct_foo']
I am confused. PHP is a server language. Client side I meant JS
sorry, I meant serverside
Okie so in server, PHP, you created a Checkout Session with stripe-account header, correct? Then the Checkout Session belongs to that Connected Account
How do you redirect in client side?
correct, I then pass the payment intent and use the JS to redirect.
something like:
const stripePromise = loadStripe('{{ $stripeKey }}');
const stripe = await stripePromise;
await stripe.redirectToCheckout({ sessionId: event.detail.sessionId });
Okie, this $stripeKey here is a Publishable Key, correct?
that is correct
I bet it's the Platform Publishable Key, so this stripePromise will only know what is belongs to the Platform
You need to pass the stripe account header here, in client side, too
ah sweet, I didn't realise that was a thing
I will try that now. Thank you very much ๐
out of interest, I was just inspect the returned session, and it includes a URL, which I have not seen before. Can I just redirect to that serverside? I thought the redirect had to happen on the front end, which is why I have done it this way
Yes ๐ serverside redirect is newer approach and it will save you all of this headache ๐
Something like
return $response->withHeader('Location', $session->url)->withStatus(303);
oh that is amazing! That should make things a lot simpler in my code. Thank you very much for your time ๐