#mhiggie-account-link
1 messages · Page 1 of 1 (latest)
Hi, thanks for helping
so I am able to onboard a user through the express connect account flow
when i hit the accountlink endpoint i provided my express route
this route calls the retrieve api and checks the users stripe account to see if charges_enabled and details_submitted
doing all that on my backend with express and node
but what do i actually send back to my frontend
i was playing around with redirects but had trouble, also played around with a res.sendFile to send back a static html page from my back end but having issues with both
not sure I follow what you're going for
Like you have an Account, you check various things to confirm you have what you need (ignore details_submitted but look at requirements instead)
but what does res.sendFile have to do with this?
i am providing a return url which is route that checks certain account details by making an additional api request to stripe, but what exactly do i send to the client here?
am i supposed to redirect or sendFile? just not really sure the next step here and hoping you could explain a best practice?
I'm sorry I'm really not following you
Can you share real code which might help? You didn't mention the language for example
yeah that would be great
working with node
express
all js
thank you im still learning here, appreciate ur help
const accountLink = await stripe.accountLinks.create({
account: stripeId,
refresh_url: 'https://example.com/reauth',
return_url: http://localhost:4741/stripe/return/${id},
type: 'account_onboarding',
});
`//Route for return urls from accountLink
router.get('/stripe/return/:id', async (req, res, next) => {
let userID = req.params.id
let user = await User.findById(userID)
let stripeID = user.stripeId
const stripeAccount = await stripe.accounts.retrieve(stripeID);
console.log(stripeAccount)
const signOutUser = () => {
user.token = null
user.save()
}
let chargesEnabled = stripeAccount.charges_enabled
let detailsSubmitted = stripeAccount.details_submitted
if (chargesEnabled && detailsSubmitted) {
// res.sendFile(__dirname + '/onboardingComplete.html')
// log out user
// redirect to login page
// fire success message (this is in frontend)
res.json({stripeAccount})
} else {
res.sendFile(__dirname + '/onboardingIncomplete.html')
}
})`
Eh ya know what don't spend any time on this. I think I just need to think more about it..
thanks for the requirements pointer
Yeah, I find it helpful to write down what I want my applications/integrations to do. First from a user perspective and then break that down into functionality I need to build out. But it helps if you know the entire flow start to finish first.
definitely
thanks for the help. I wish I could articulate my issue better lol '