#eliasknudsen
1 messages · Page 1 of 1 (latest)
Hello
yoyo
What type of Connected Accounts are you going to be working with?
What i am thinking after reading the docs, was to create an account like this: ``` app.get("/api/user/payouts", async (req, res) => {
try {
const account = await stripe.accounts.create({ type: 'express' });
const accountLink = await stripe.accountLinks.create({
account: account.id,
refresh_url: 'https://example.com/reauth', //Local url
return_url: 'https://example.com/return', //Local url
type: 'account_onboarding',
});
console.log(accountLink);
res.status(200).send({ message: "Link has been made", data: accountLink, error: false })
} catch (error) {
res.status(400).send({ message: "An error has occured", error: true })
}
})``` And then get the connected account id from webhook, and paying that customer if someone has bought from the connected accounts sharable link. Basically affiliate
The sharable link, is something i make. Here is my payment intent: ``` const paymentIntent = await stripe.paymentIntents.create({
amount: parseInt((result.estimate.result.costs.total * 100).toFixed(0)),
currency: "usd",
automatic_payment_methods: {
enabled: true,
},
metadata: { payment_intents_id: id.result }
});```
Gotcha so yeah you want to use transfer_data.destination here
And transfer_data.amount to determine how much to transfer
ait, thanks. Is there a webhook after the customer has successfully created an account, and is eligble to get paid?
Yep you want account.updated
Ok, thanks for the help:)