#hammad-umar_code

1 messages ¡ Page 1 of 1 (latest)

marble ravenBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1265947308558782506

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

fringe aurora
#

Hi, let me help you with this.

magic venture
#

No results found in developers > Logs

#

I am using nodejs stripejs in my localhost using test api key

#

router.get("/testing-stripe", async (_, res) => {
try {
// Create a Stripe Custom account
const account = await stripe.accounts.create({
type: "custom",
country: "US",
email: "hammadumar8080@gmail.com",
business_type: "individual",
individual: {
first_name: "Hammad",
last_name: "Umar",
},
capabilities: {
card_payments: { requested: true },
transfers: { requested: true },
},
});
// Create a bank account token
const token = await stripe.tokens.create({
bank_account: {
country: "US",
currency: "usd",
account_holder_name: "Hammad Umar",
account_holder_type: "individual",
routing_number: "110000000",
account_number: "000123456789",
},
});
// Attach the bank account token to the Custom account
const bankAccount = await stripe.accounts.createExternalAccount(
account.id,
{
external_account: token.id,
}
);
// Make transfer to the bank account.
const payout = await stripe.payouts.create(
{
amount: 10000, // Amount in cents (e.g., $100)
currency: "usd",
destination: bankAccount.id,
},
{
stripeAccount: account.id,
}
);

return res.json({
  account,
  token,
  bankAccount,
  payout,
});

} catch (error) {
console.error("Error creating bank token:", error);
return res.status(500).json({ message: error.message });
}
});

Thats the endpoint code.

#

@fringe aurora

#

By the way i found out req id
This is the request ID: req_hMMit68E5kG3rL

#

The problem is only with this snippet
// Make transfer to the bank account.
const payout = await stripe.payouts.create(
{
amount: 10000, // Amount in cents (e.g., $100)
currency: "usd",
destination: bankAccount.id,
},
{
stripeAccount: account.id,
}
);

#

When i hit got this error

{
"message": "Cannot create payouts: this account has requirements that need to be collected. Please provide those fields to re-enable payouts."
}

fringe aurora
#

I see the error, thank you.

#

In order to use Stripe Connect for charges and payouts, each Connected account needs to be verified, i.e. go through onboarding and provide their business information. Simply creating the Connected account is not enough.

#

I recommend you to go through this guide to learn how to properly create and onboard a Connected account. Connected accounts of type="custom" are used for advanced scenarios, I wouldn't recommend it unless you have a strong reason. type="express" should do just fine for most cases: https://docs.stripe.com/connect/express-accounts

magic venture
#

And can you guide me how can I achieve my use case and can I test this scenario in test mode with out onboarding each user to verify their account ?

fringe aurora
#

The guide explains just that, I can't explain it better. I am happy to answer any follow-up questions after that.

In Test mode, you will still need to go through onboarding, but you can provide fake info.

magic venture
#

Ok Got It. Thank You. If I need any further help after reading the docs, I'll ket you know.

fringe aurora
#

Happy to help.