Flutter oAuth : how to get started with OAuth and Stripe connect

前端 未结 3 820
南笙
南笙 2021-01-23 02:25

I am trying to implement stripe connect in my flutter app. Here are the steps I need to implement. Can anyone please navigate me on how I could achieve this in Flutter?

3条回答
  •  暖寄归人
    2021-01-23 03:02

    The answer selected is not completely correct: If you dont assign the account_id to a user then it's of no use. The only way to pass the user_id (fUser.uid) is to pass it using the state parameter.

    exports.StripePI = functions.https.onRequest(async (req, res) => {
    //    console.log('accountIdq ' + req.query.error);
    //    console.log('accountIdq ' + req.query.state);
    //    return;
    //        if(!req.query.code)
    //            return res.send("An Error has occured please try again");
        const response = await stripe.oauth.token({
          grant_type: 'authorization_code',
          code: req.query.code,
        }).then(async response => {
                var connected_account_id = response.stripe_user_id;
              await admin.firestore().collection('Registration').doc(req.query.state)
                               .update({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");
            });
    });
    

提交回复
热议问题