I have the following WebView Widget / I am trying to trigger the completion (or not) of a StripeConnect account creation, in order to close the View. I can t find any doc about what should be the triggered channel.
child: WebView(
initialUrl:
stripeConnecturl,
javascriptMode: JavascriptMode.unrestricted,
javascriptChannels: [
JavascriptChannel(name: 'response', onMessageReceived: (s) {
print('everything is okay');
print(s.message);
Navigator.pop(context);
}),
].toSet(),
and here s my Cloud function
exports.connectStripeExpressAccount = functions.https.onRequest((req, res) =>{
console.log('query state is ----> ' + req.query.state);
const authCode = req.query.code;
return stripe.oauth.token({
grant_type: 'authorization_code',
code: authCode,
}).then(async response => {
var connected_account_id = response.stripe_user_id;
const uid = req.query.state
const writeResult = await admin.firestore().collection('Registration').doc(uid)
.set({'customer_id': connected_account_id});
return res.send("Well done, account integration is completed. You can now close the window and go back to the app");
});
});