#tarunmv30_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1257771573012860958
๐ Have more to share? Add details, code, screenshots, videos, etc. below.
Hello
Depending on the type of payments you're creating as a platform, you can deduct application fees prior to the transfer.
Can you share how you're creating the charges? An example might help
For example,
Here's how you'd collect fees using Direct charges: https://docs.stripe.com/connect/destination-charges?platform=web&ui=elements#collect-fees
Here's how you'd collect fees using Destination charges: https://docs.stripe.com/connect/destination-charges?platform=web&ui=elements#collect-fees
Umm the screenshot isn't super helpful, can you share an example PaymentIntent ID? pi_xxxx
this is the code for creating the transaction
yes one moment
pi_3PYBKPBTLjxEqPSB0E4HHzXa
So looks like you're creating Destination charges. If you look at the request your code made, https://dashboard.stripe.com/test/logs/req_ksJQEHPNRM9vnT
for 100.00 USD, you're collecting 13 cents as fees (not $13)
how do i make that 13% not 13 cents
specifically, application_fee_amount: "13"
Your code is using the right parameter, just the amount it is setting is incorrect
and would destination charges be the smartest way to acheive this goal?
Yup, your funds flow is fine. You just need to fix the calculation you're doing before setting that to application_fee_amount
roger that thank you!
and so in theory last question
if im charging 13%
i should never have a negative platform balance right?
Correct
sweet thank you hanzo!
I think the bug in your code is that you're multiplying it by 100 inline
so amount variable is multiplied before you set it to amount parameter
But you don't do the same thing when you calculate the fees
So your fee calculation is ,
Math.floor(100 * 0.13)
Instead of
Math.floor(10000 * 0.13)
does that make sense?
got you so updating the 100 to 10000 is what you think would fix the issue
Sorry, let me be more specific.
Let's look at your code on line 122
You are converting dollar amount to cents before you make the API request
however on line 126
you are not converting the dollar amount to cents
before calculating the fees
So fees are being calculated for amount=100 cents instead of amount=10000 cents
const totalAmountInCents = Math.round(amount * 100); // Convert to cents and round
const applicationFeeInCents = Math.round(totalAmountInCents * 0.13); // 13% fee in cents
so what if i pass applicationFeeinCents in line 126
Yup that should work
appreciate you Hanzo been a huge help!
Happy to help! ๐
can i send you my new pI so you can verify its working correctly
pi
pi_3PYC8jBTLjxEqPSB2bIQlrjq
You can check the request body to verify
so it succesffuly took 13 out of $100 but i dont see the 13 in the platform account balance
It will take a few days for the amount to settle (like it would for a real live mode charge)
roger