I’m using stripe connect, I need to add the connected ‘account_id’ to the client side Stripe component.
So I get the account_id from the db, and load it in there using a dynamic attribute:
The Connected Account was indeed necessary when initializing Stripe JS a few months ago, but they removed this requirement. It is no longer needed in the Stripe JS element. See mine below, works perfectly fine:
However, make sure the Connected Account is specified in the Header of the Server Side Stripe APIs, for example right there in the Create Checkout Session:
Also make sure your Stripe JS script is loaded on every single page of your webapp, in order to enable Stripe’s “advanced fraud functionality”.
@Fred_K Thanks for your help… I’m really confused how your integration is working. I guess the difference lies in that you’re using ‘Create Checkout Session’ and not ‘paymentIntent’, is that true?
I have the same set up now:
Server side an action ‘Create Payment Intent’, with the connected account and API key in the options:
But it’s trying to confirm it in the platform account (first screenshot). When I add the account_id on the client side it does work. But then I’m back to the original problem, it’s initialising the stripe element before the account_id is retrieved from the db.
@mebeingken Thanks - also tried this. But then stripe throws an error.
I put it in a simply conditional region first, based on a toggle.
Whenever it’s trying to work inside the conditional region I get this error:
TypeError: Cannot read properties of null (reading ‘getElement’)
@Fred_K I really appreciate the help, because it was time sensitive I fixed it by using EJS. I’m getting the stripe connect variable before the page is loaded and put it in an EJS variable. Then I put it into the ‘stripe’ component from wappler.
However, I do think this is something the Wappler devs should fix by delaying the execution of the component until the variable for “account_id” is loaded from the database.