#hammad-umar_api

1 messages ¡ Page 1 of 1 (latest)

prisma spireBOT
#

👋 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/1265988623548026962

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

wise roseBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

floral token
fast depot
#

router.get("/testing-stripe-exp", async (req, res) => {
try {
const account = await stripe.accounts.create({
type: "express",
country: "US",
email: "toseef@gmail.com",
capabilities: {
card_payments: {
requested: true,
},
transfers: {
requested: true,
},
},
});

const accountLink = await stripe.accountLinks.create({
  account: account.id,
  refresh_url: "http://localhost:5002/redirect",
  return_url: "http://localhost:5002/redirect",
  type: "account_onboarding",
});

// acct_1PgOn8PoK1icUARN

const transfer = await stripe.transfers.create({
  amount: 2000,
  currency: "usd",
  destination: "acct_1PgOn8PoK1icUARN", // Stripe Account ID.
});

return res.json({
  account,
  accountLink,
  transfer,
});

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

Here is the code just for the testing, Can I use the correct API's for creating user accounts and generating account links then create payouts for their bank accounts ?

floral token
#

Wait, I thought you didn't want to use Account Links? Your original question:

Can we create a custom onboarding process without redirecting the user to accountLink.url ?

fast depot
#

This is my use case:
I want to create an application in which user can create express accounts and admins can release funds to their accounts. Because we have mobile application using flutter we want to create custom onboarding flow for mobile app not using the web. ???

#

This is my use case:
I want to create an application in which user can create express accounts and admins can release funds to their accounts. Because we have mobile application using flutter we want to create custom onboarding flow for mobile app not using the web. ???

floral token
#

Then sure, using the API as I already described

fast depot
#

ok then we don't need accountLink ?

floral token
#

No

fast depot
#

And is this the correct api for releasing funds to user bank accounts ?

const transfer = await stripe.transfers.create({
amount: 2000,
currency: "usd",
destination: "acct_1PgOn8PoK1icUARN", // Stripe Account ID.
});

floral token
#

No, that will transfer funds to their Stripe account balance. Moving money to an external (bank) account is done via a payout

fast depot
#

can you share the API details ?

floral token
fast depot
#

Can you guide me further ?
If I am an admin and i want to send money to any user bank account can you share any code snippet for that in node.js ?

#

I got this error when i want to create a payout to externel account ?
{
"message": "Cannot create payouts: this account has requirements that need to be collected. Please provide those fields to re-enable payouts."
}

#

router.get("/testing-stripe", async (_, res) => {
try {
// Create a Stripe Custom account
const account = await stripe.accounts.create({
type: "express",
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 });
}
});

Please review that code only problem with payout statement

floral token
#

Yep, sounds like your account has not been onboarded/verified correctly. You'd either do that via the Account Link, or using the API directly with test data to transition account to a verified state: https://docs.stripe.com/connect/testing

Before going live, test your Connect integration for account creation, identity verification, and payouts.