#warre002-connect-node
1 messages ยท Page 1 of 1 (latest)
This is my code```
// Creates an account on Stripe with the already known data
async function createAccountID(land_code, email){
const account = await stripe.accounts.create({
country: land_code,
type: 'custom',
email: email,
capabilities: {
card_payments: {
requested: true
},
transfers: {
requested: true
},
},
});
return account
}
async function createAccountLink(stripe_id){
const accountLink = await stripe.accountLinks.create({
account: stripe_id,
refresh_url: 'http://localhost:4000/payments/reauth?stripe_id='+stripe_id, // This should redirect to the server with the stripe_id in the link as a parameter. The api generates the new link
return_url: 'http://localhost:4000/payments/return', // redirects back to the server and should redirect to the stripe url
type: 'account_onboarding',
});
return accountLink
}
router.get("", CheckJWT, async (req,res) => {
const land_code = req.body.land_code
const email = req.body.email
if(land_code, email){
const accountId = await createAccountID(land_code, email)
const accountLink = await createAccountLink(accountId.id)
res.json({success: true, link: accountLink.url})
} else {
res.json({success: false, message: "Provide your land code and email."})
}
})
I'm following the guide on the website: https://stripe.com/docs/connect/connect-onboarding
Could the problem be that you've to set redirect pages in stripe?
are you seeing any network request failing in your console? or any error messages?
ah nice, what was it?
Well just a stupid mistake, I wasn't returning anything on the page it was redirecting to.
Sorry for wasting a bit of your time.
NP! ๐ Glad you're unblocked