I am trying to pass a FirebaseFirestore User Uid to a Stripe / firestore cloud function.
So I would have an https query like following :
https://connect.stripe.com/express/oauth/authorize?response_type=code&client_id={accountid}&scope=read_write to open in a Webview
Here is my 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");
});
});
client_idquery string parameter? Your code shows an HTTP Cloud Function, that will be exposed by an URL but this URL is nothttps://connect.stripe.com/express.... So where are you building and calling thehttps://connect.stripe.com/...URL with theclient_idquery string parameter? - Renaud TarnecconnectStripeExpressAccountCloud Function is connected to the other steps? Is it exposed as a webhook that Stripe calls? In other words: you write "Accessing this url to stripe launches a default function witch is set to be connectStripeExpressAccount" but how does your "system" (i.e. Flutter app + Stripe + Cloud Function backend) launches the Cloud Function? - Renaud Tarnec