#Jane_Zhong
1 messages ยท Page 1 of 1 (latest)
๐ happy to help
would you mind sharing more details please?
event IDs, code snippets etc
Yes ,this is the webhook I set , and the Express Account create twice when the user modify twince the form : ```app.post(
"/stripe",
bodyParser.raw({ type: "application/json" }),
async (req, res) => {
const sig = req.headers["stripe-signature"];
let event = JSON.parse(req.body);
try {
event = stripe.webhooks.constructEvent(
req.body,
sig,
process.env.STRIPE_WEBHOOK_SECRET
);
} catch (err) {
// On error, log and return the error message
console.log(`โ Error message: ${err.message}`);
return res.status(400).send(`Webhook Error: ${err.message}`);
}
//handle the account create
if (event.type === "")
if (event.type === "account.updated") {
// Handle account updates
const account = event.data.object;
const previousAccount = event.data.previous_attributes;
if (
account.charges_enabled &&
!previousAccount.charges_enabled &&
!expressAccountCreated
) {
expressAccountCreated = true; // Set flag to true after account creation
// The account was just created and is fully set up and ready to process payments
// Do something with the account data
const { userPublicId } = account.metadata;
const user = await UserInfo.findOne({ publicId: userPublicId });
await Withdraw.create({
userId: user.id,
card: account.id,
country: account.country,
phone: account.company.phone,
email: account.individual.email,
valid: true,
});
}
}
}
);
Hi! I'm taking over this thread.
Hi Soma ,nice to see you again
the Express Account create twice when the user modify twince the form
What do you mean by "user modify twice the form"?
And how do you create the Express accounts?
Are you using this? https://stripe.com/docs/connect/express-accounts#create-account
Well , when set up a function where allow user's to create Express Account ,users need to fill up datas such as Email ,company etc . And sometimes ,if users skip some form ,the form won't notice you that 'this cant be empty' till the last step for submitting .And it will need users to complete the forms in order to submit those datas .And after the user fill up all the information ,and submit ,it will create twice Express Account . And it won't happen if the user fill up all the information and submit in one time .
Yes, I am following this guides ,and using node.js and React Native .
Is it possible to detect in the webhook if the Express Account is Limited ,delete this account ?
If the user doesn't submit all the onboarding information, you need to create a new Account Link with the existing account ID: https://stripe.com/docs/connect/express-accounts#create-link