I have the following method that I need to call from 'stripe' npm package to create a login link for the user.
stripe = require('stripe)('tok_123');
stripe.accounts.createLoginLink(
'acct_123',
function(err, link) {
// asynchronously called
};
);
Now this method above is being called inside a google cloud function on HTTP call:
functions.https.onCall(async (data, context) => {
// create stripe login link
return {
'link': <link created from createLoginLink>
};
});
I would like to return the link from the callback. I am not sure how to do that, how do I wait until the callback function is called and finished inside the body of onCall?