[Web] Can't set Stripe Account ID
appeventic opened this issue · 2 comments
Describe the bug
There are many previous similar issues like (1785 and 1798) which are marked as closed. We're using latest package version but still facing same issue. I'm making payment for Stripe connected account. Entire flow works fine in iOS/Android app but with web I'm seeing error, please see below for more details -
To Reproduce
- create payment intent in the backend with stripeAccount as below -
const paymentIntent = await stripe.paymentIntents.create(
{
amount: totalAmountInCents, // Amount in cents
currency: 'usd',
application_fee_amount: platformFee,
automatic_payment_methods: {
enabled: true,
allow_redirects: 'never'},
description: transactionDetails,
metadata: {
additionalParams: JSON.stringify(req.body),
},
},
{
stripeAccount: accountId,
}
);
- On the client side change stripe accountId using
Stripe.stripeAccountId
and thenawait Stripe.instance.applySettings();
- On client side confirm payment using await
Stripe.instance.confirmPayment
with clientSecret received from step1.
Expected behavior
Should be able to confirm the payment intent. But its giving this error - IntegrationError: Please use the same instance of Stripe you used to create this Element to create your Source or Token.

flutter_stripe: ^11.1.0
flutter_stripe_web: ^6.1.0
Really appreciate if someone please help, how we can complete connected account payment in flutter web. We're completely blocked :(
More update on this - this only works if we set the stripeAccountId
in main.dart while init the Stipe instance. But stripeAccountId
is dynamic so if we want to change it in payment screen it doesn't work.
This is resolved, I had to assign the stripeAccountId before launching the screen which is showing the PaymentElement.