#darve
1 messages · Page 1 of 1 (latest)
So you're trying to create payments that go directly to the connect account correct?
Correct
I want my clients to be able to use my platform to charge their customers and get paid into their own stripe account.
Do you have a Payment Intent ID I can look at that shows the payment going to your account? What code are you using to submit the payment?
You need to make sure the Account ID you're putting into this code is the connected account's ID, not your platform ID:
stripeAccount: '{{CONNECTED_ACCOUNT_ID}}',
pi_3Nctu0HZx1IyzUZ80XZ9KK9N this is one for example
Yep I've checked that I'm using the connected accountId
And here is the code...
hold on let me format
`exports.createPaymentLink = async (req, res) => {
const settings = UserSettings.findOne({ user: req.body.user });
if (!settings) {
return res.status(404).send({
error: "User not found.",
});
}
const stripe = require("stripe")(
PLATFORM_SECRET,
{
stripeAccount: settings.stripeAccountId,
}
);
console.log(req.body.amount);
const price = await stripe.prices.create(
{
unit_amount: 1000,
currency: "usd",
product_data: {
name: req.body.name,
},
},
{
stripeAccount: settings.stripeAccountId,
}
);
const paymentLink = await stripe.paymentLinks.create(
{
line_items: [
{
price: price.id,
quantity: 1,
},
],
transfer_data: {
destination: settings.stripeAccountId,
},
on_behalf_of: settings.stripeAccountId,
},
{
stripeAccount: settings.stripeAccountId,
}
);
res.send(paymentLink);
};
`
wow fail...but I hope you can understand
The transfer_data and on_behalf_of arguments I added after trying over and over to make it work, but the docs say that I just need to add the {stripeAccount: {{accountID}} } in the create calls
Sorry to waste your time!! I have tried hardcoding the connected acount Id into the function and it works. The issue seems to be in my retrieval of the accountID from my mongodb database!
Ahhhh, okay. Well glad I could at least be a proper rubber duck 🦆
Haha cheers! Stripe has been the best documented and supported API I have ever encountered... keep up the good work gents