#shakilkhan496
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. 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.
- shakilkhan496, 1 hour ago, 6 messages
hi! I think the error is pretty explanatory, what question did you have?
This solution I got from previous support. So I need to onbording connected account with recipient service agreement
While I am doing this with api , I am getting that error.
the API error is very clear about how to fix it though, just read it.
i.e. you need to change what requestsed_capabilities you pass, since only transfers is allowed.
{
"tos_acceptance": {
"service_agreement": "recipient"
},
"type": "express",
"email": "eexxsdx@gmail.com",
"country": "GB"
}
this was req.body
add requested_capabilities:["transfers"] to it
Thanks
Error: The recipient ToS agreement is not supported for platforms in US creating accounts in US. See https://stripe.com/docs/connect/cross-border-payouts for more details.
I have this error now
app.post('/create-account', async (req, res) => {
try {
const account = await stripe.accounts.create({
country: 'US',
type: 'custom',
capabilities: {
transfers: {
requested: true,
},
},
tos_acceptance: {
service_agreement: 'recipient',
},
});
// Generate onboarding link for the created account
const accountLink = await stripe.accountLinks.create({
account: account.id,
refresh_url: 'https://your-site.com', // Replace with your site's URL
return_url: 'https://your-site.com', // Replace with your site's URL
type: 'account_onboarding',
});
// Return the onboarding link to the client
res.json({ onboardingLink: accountLink.url });
} catch (error) {
console.error('Error:', error.message);
res.status(500).json({ error: 'Internal Server Error' });
}
});
yep, as it says
you can't pass country: 'US', and use the receipient agreement, it's only for when you're creating accounts in other countries
Okay let me try
So my connected account is set
Now I have another problem when trying to req for a paymentintent with on_behalf_of
I can get client secret correctly
app.post('/create-payment-intent', async (req, res) => {
const amount = 3999; // assuming amount is in the lowest currency unit (e.g., cents)
const connected_accountId = 'acct_1OWyDCQwD5Oky0YM';
const currency = 'gbp'; //
try {
// Create PaymentIntent without application_fee_amount and with manual capture
const paymentIntent = await stripe.paymentIntents.create({
amount,
currency,
automatic_payment_methods: {
enabled: true,
},
on_behalf_of: connected_accountId,
payment_method_options: {
card: {
capture_method: 'manual',
},
},
});
// Create a separate transfer for the application fee
// const transfer = await stripe.transfers.create({
// amount: 123, // your application fee amount
// currency,
// destination: connected_accountId,
// });
res.send({
client_secret: paymentIntent.client_secret,
// transfer_id: transfer.id,
});
} catch (error) {
console.error(error);
res.status(500).send(error.message);
}
});
This is the server code
And when I am putting the card information on front end , It shows "{
"error": {
"message": "You cannot create a charge with the on_behalf_of parameter set to a connected account with transfers but without the card_payments capability enabled.",
"payment_intent": {
"id": "pi_3OWyL9JRdeoMFQJ228XUgbeJ",
"object": "payment_intent",
"amount": 3999,
"amount_details": {
"tip": {
}
}," This error message
yep, as it says
if you're using a receipient(with only the transfers capability), you can not use on_behalf_of
So how can I charge an application fee while they receive any payment for their services?
the application fee is nothing to do with on_behalf_of.
So, as a platform account, we want to get our fees from the connected account, and those account's regions are not the same as the platform account. Then how can we charge our connected account when they create any payment intent? I need guidance for this. Please
if you're using the Separate Charges and Transfers model, https://stripe.com/docs/connect/separate-charges-and-transfers#collecting-fees is how you take a fee(you pass a smaller amount to the Tranfers API than you charged in the PaymentIntent).
But initially, the connected account balance is zero. How to handle this?
Here is my code "app.post('/create-payment-intent', async (req, res) => {
const amount = 3999; // assuming amount is in the lowest currency unit (e.g., cents)
const connected_accountId = 'acct_1OWyDCQwD5Oky0YM';
const currency = 'gbp'; //
try {
// Create PaymentIntent without application_fee_amount and with manual capture
const paymentIntent = await stripe.paymentIntents.create({
amount,
currency,
automatic_payment_methods: {
enabled: true,
},
on_behalf_of: connected_accountId,
payment_method_options: {
card: {
capture_method: 'manual',
},
},
});
// Create a separate transfer for the application fee
const transfer = await stripe.transfers.create({
amount: 123, // your application fee amount
currency,
destination: connected_accountId,
});
res.send({
client_secret: paymentIntent.client_secret,
transfer_id: transfer.id,
});
} catch (error) {
console.error(error);
res.status(500).send(error.message);
}
});"
Here is the error message : "You have insufficient available funds in your Stripe account. Try adding funds
directly to your available balance by creating Charges using the
4000000000000077 test card. See:
https://stripe.com/docs/testing#available-balance"
I don't see how that matters?
yes, you can't transfer immediately after doing the payment
Can you check my code , if the flow is correct ?
it's not, no.
So , how can we implement that flow?
see the docs above.
Okay , I have followed the docs
And here is my code "app.post('/create-payment-intent', async (req, res) => {
const amount = 3999; // assuming amount is in the lowest currency unit (e.g., cents)
const connected_accountId = 'acct_1OWyDCQwD5Oky0YM';
const currency = 'gbp'; //
const chargeAmount =100;
try {
// Create PaymentIntent without application_fee_amount and with manual capture
const paymentIntent = await stripe.paymentIntents.create({
amount,
currency,
automatic_payment_methods: {
enabled: true,
},
// on_behalf_of: connected_accountId,
payment_method_options: {
card: {
capture_method: 'manual',
},
},
});
//step 2: Create charge object
const charge = await stripe.charges.create({
amount: chargeAmount,
currency: 'usd',
source: connected_accountId,
});
// Create a separate transfer for the application fee
const transfer = await stripe.transfers.create({
amount: chargeAmount,
currency: currency,
source_transaction: charge.id,
destination: connected_accountId,
});
res.send({
client_secret: paymentIntent.client_secret,
transfer_id: transfer.id,
});
} catch (error) {
console.error(error);
res.status(500).send(error.message);
}
});"
And I got "Account debits are not supported from GB to US."
yep, account debits are not supported
why are you doing an account debit? we never discussed that at all.
What should the flow be? For example, if I want to charge connected accounts when they are making any payment intent, we need to use charge.create, then get the charge ID, and then we can make a transfer request. Can you see the code and, if I am familiar with the flow of work,. Can you please give me instructions? For example, I have created a payment intent as I have a connected account, and the platform account will charge me a fee. How can I do this? Can I do it with a single api call, or will I need to handle that with a webhook, such as when every payment is successful, we will charge? I don't know how to do it. Kindly give me a detailed instruction, please.
if I want to charge connected accounts when they are making any payment intent,
why do you want that?
why not just process the payment and take a fee from that payment? [0] You don't need to "charge" the account separately, you can take a fee that way.
[0] - if you're using the Separate Charges and Transfers model, https://stripe.com/docs/connect/separate-charges-and-transfers#collecting-fees is how you take a fee(you pass a smaller amount to the Tranfers API than you charged in the PaymentIntent).
Hi , "app.post('/create-payment-intent', async (req, res) => {
const amount = 3999; // assuming amount is in the lowest currency unit (e.g., cents)
const connectedAccountId = 'acct_1OWyDCQwD5Oky0YM'; // Replace with the actual connected account ID
const currency = 'gbp';
const feePercentage = 0.05; // Example: 5% fee
try {
// Create PaymentIntent with transfer_data for the application fee
const paymentIntent = await stripe.paymentIntents.create({
amount: Math.round(amount * feePercentage),
currency,
transfer_data: {
destination: connectedAccountId,
amount: Math.round(amount * feePercentage),
},
});
res.send({
client_secret: paymentIntent.client_secret,
});
} catch (error) {
console.error(error);
res.status(500).send(error.message);
}
});"
This api worked correctly with charge also
But the problem is , platform is getting the total amount but the connected account getting only a small amount. But we want to do a small charge from connected id
Can you check the code and tell me what is wrong?
hi! I'm taking over this thread.
if you want the connected account to get more, then increase the feePercentage.
this line is the amount sent to the connected account: amount: Math.round(amount * feePercentage).
Thank you , Then what is the best word to call that variable "fee percentage"? This amount is being transferred to the connected account, and this is not the fee.
are you asking me how to name the variable itself? that's completely up to you. something like percentageForConnectedAccount.
Thanks a lot. I got my solution.