#Jane_Zhong
1 messages ยท Page 1 of 1 (latest)
๐ Thanks for reaching out
AFAIK, there is no such an option in Dashboard but for this kind of request (delete all accounts according to a criteria), I think you can check with Stripe Support about this at https://support.stripe.com/contact
But what you can do using the API, you can delete them one by one:
https://stripe.com/docs/api/accounts/delete
Hi my friend ,thank you so much for your answer . I know the way delete one by one but it is a bit tough :p ,Therefore ,I was thinking if there is a easier way .
Hmmm , I have another question , I have realize that ,when submit all the datas to create an Express Account ,if you fill all the fields in one time ,the account will only create one for a user in one time .However ,if modify the form before submittin ,will create two times ... I am not sure is it the problem of Stripe or the webhook .As I am using Node.js .Could you please take a look my webhook ? Thank you so much in advance !
However ,if modify the form before submittin ,will create two times
Can you share an example ?
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}`);
}
// for express account
if (event.type === "account.updated") {
const account = event.data.object;
const previousAccount = event.data.previous_attributes;
if (account.charges_enabled && !previousAccount.charges_enabled) {
await Withdraw.create({
userId: user.id,
card: account.id,
country: account.country,
phone: account.company.phone,
email: account.individual.email,
valid: true,
});
}
}
res.json({ received: true });
}
);
Yes this is your code, so it looks like your code is creating twice the account
But keep in mind that sometimes Stripe delivers duplicate events:
https://stripe.com/docs/webhooks/best-practices#duplicate-events
Oh no ... Could you please help me modify it ?
It dosen't have node.js version in your doc .
This is a particular use case, you need to do a check on account.id if it exists on your database, and create a Withdraw only if no elements exists...
Ahh ,ok ,thank you my friend ! ๐
Welcome!