#kun_api
1 messages · Page 1 of 1 (latest)
đź‘‹ 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/1405973543275200552
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- kun_api, 3 days ago, 25 messages
hi! i'm working on a few threads but i'll get back to you asap
it looks like your question got cut off, can you share the rest of it here?
sure
I’m integrating Stripe subscriptions with Connect (Express accounts) for an affiliate system.
First, I create a connected account with this configuration:
const account = await stripe.accounts.create({
type: 'express',
email: userEmail,
business_type: 'individual',
capabilities: {
card_payments: { requested: true },
transfers: { requested: true },
},
metadata: {
supabaseUserId: userId,
role: 'affiliate',
affiliateCommissionPercentage: '10%',
transferFormula: 'Affiliate commission percentage applied to all successful recruiter payments',
},
});
Later, when a recruiter gets a subscription, I try to send a percentage of the payment to the affiliate’s connected account:
const subParams = {
mode: 'subscription',
line_items: [
{ price: process.env.VALITRON_SUBSCRIPTION_PRICE_ID, quantity: 1 },
{ price: process.env.VALITRON_OVERAGE_PRICE_ID },
],
success_url: `${process.env.VALITRON_APPLICATION_URL}/recruiter/credits/success?session_id={CHECKOUT_SESSION_ID}`,
cancel_url: `${process.env.VALITRON_APPLICATION_URL}/recruiter/credits/cancel`,
metadata: recruiterEmail
? { recruiter_email: recruiterEmail, plan: 'SUB' }
: { plan: 'SUB' },
};
const affiliate = await fetchAffiliatePayoutByUserId(referred_by_affiliate_id);
if (affiliate?.destination) {
subParams.subscription_data = {
...(subParams.subscription_data ?? {}),
transfer_data: { destination: affiliate.destination },
application_fee_percent: affiliate.feePercent, // e.g., 10
};
}
The issue: When the subscription’s invoice is successfully paid, the entire payment goes to the destination (affiliate’s connected account). I expected only the application_fee_percent (e.g., 10%) to go there, with the rest staying on the platform account.
How can I configure the subscription so that only the specified percentage is transferred to the destination account, and the remainder stays with the platform?
any help?
hi! sorry, as i mentioned earlier i'm juggling a few issues at the moment and my responses might be delayed
not currently. i have read through your question though and i think i know what the issue is
sure ill wait for your response
the application fee is the amount that is kept by the platform account, so what you're describing is the expected behavior
I wanted that 10% should go to connected account and 90% stays in platform
can you share an example subscription ID you've created like this so i can double check some things?
no, the actual ID of the subscription you've created
it looks like this: sub_[random characters]
the short answer though is that you want to set application_fee_percent to 90% if you want to keep 90% of the payment in the platform's balance
by the way I am working on stripe test enviorment
ohhh i got it now
transfer_data: { destination: affiliate.destination },
application_fee_percent: affiliate.feePercent, (this should be 90)
then automatically 10 % will go to destionation account?
ok yep, it looks like for the invoice in_1Rw73CFrwl37tCGiUJi4NTSD you have amount set to $50.00 and the application fee set to $5.00. so the application fee is working correctly, you were just thinking it did the opposite of what it does
yep!
the connected account gets $50.00
and my platform gets nothing
double checking some things
if you look at the payment associated with that invoice:
https://dashboard.stripe.com/acct_1E4JzvFrwl37tCGi/test/payments/pi_3Rw7zjFrwl37tCGi0blnQqIS
you can see that it reports a collected fee of $5.00, which is accurate
you can click into the fee details here as well
https://dashboard.stripe.com/acct_1E4JzvFrwl37tCGi/test/connect/application_fees/fee_1Rw7zl2IJToqDw8WaDALzfXE
so everything looks like it's working to me (aside from the fact that you need to swap the application_fee_percent to 90)
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
please look at this
there is no $50.00 transction i can see
even my connected account gets total 50 usd
the $50 transaction is showing in that screenshot, about halfway down. the $5 application fee is not expected to show in that page as it isn't a transaction, it's a transfer of funds between accounts.
they show up in a separate UI:
https://dashboard.stripe.com/acct_1E4JzvFrwl37tCGi/test/connect/application_fees
i would recommend giving this article a read from top to bottom, as it explains how to create charges like this, as well as where to find all of the resulting fees / transfers etc.
https://docs.stripe.com/connect/subscriptions
this section specifically is very useful:
https://docs.stripe.com/connect/subscriptions#collect-fees
when you create a destination charge with application_fee_percent and with this connect account configuration, what happens is:
- we collect the $50 payment
- we charge the platform account the stripe transaction fee
- we transfer the full amount of the payment to the connect account
- we transfer the application fee back to the platform account
so that is why I in connceted account I see the full value transaction
but when I see the the details of transaction 10 % recieved by the connected accoout?
so that is why I in connceted account I see the full value transaction
yes!
but when I see the the details of transaction 10 % recieved by the connected accoout?
i'm not sure i understand what you mean by this? the 10% in this case is received by your platform account
when you create a subscription with transfer_data.destination set to the affiliate's connected account and also set application_fee_percent, the entire payment (100%) is being routed to the connected account instead of only the application_fee_percent going there with the remainder staying in your platform account.
is it true?
yes, as i mentioned above, 100% of the funds are transferred to the destination account, and the application fee is transferred back to the platform
this other article goes into a bit more detail on that:
https://docs.stripe.com/connect/destination-charges?platform=web&ui=stripe-hosted#collect-fees
got it man
last thing sho I should make application_fee_precentage to 90 so that my platform gets 90% of what transfered to connected account?
yep!
No i got it
a last quick question
before that the percentage value wa 10
then how my platform gets 90% instead it should get 10%
we saw it in transaction history
i don't think i understand what you mean? for this subscription, which was created with an application fee of 10%:
https://dashboard.stripe.com/acct_1E4JzvFrwl37tCGi/test/subscriptions/sub_1Rw5BHFrwl37tCGirQVu0KK2
this $50 payment:
https://dashboard.stripe.com/acct_1E4JzvFrwl37tCGi/test/payments/pi_3Rw7zjFrwl37tCGi0blnQqIS
resulted in this $5 application fee
https://dashboard.stripe.com/acct_1E4JzvFrwl37tCGi/test/connect/application_fees/fee_1Rw7zl2IJToqDw8WaDALzfXE
your platform got the $5 fee, which is expected since you set the application fee to 10%