#tarunmv30_api

1 messages ยท Page 1 of 1 (latest)

azure zealotBOT
#

๐Ÿ‘‹ 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.

tame igloo
#

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

dusky niche
tame igloo
#

Umm the screenshot isn't super helpful, can you share an example PaymentIntent ID? pi_xxxx

dusky niche
#

this is the code for creating the transaction

#

yes one moment

#

pi_3PYBKPBTLjxEqPSB0E4HHzXa

tame igloo
dusky niche
#

how do i make that 13% not 13 cents

tame igloo
#

specifically, application_fee_amount: "13"

Your code is using the right parameter, just the amount it is setting is incorrect

dusky niche
#

and would destination charges be the smartest way to acheive this goal?

tame igloo
#

Yup, your funds flow is fine. You just need to fix the calculation you're doing before setting that to application_fee_amount

dusky niche
#

roger that thank you!

#

and so in theory last question

#

if im charging 13%

#

i should never have a negative platform balance right?

tame igloo
#

Correct

dusky niche
#

sweet thank you hanzo!

tame igloo
#

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?

dusky niche
#

got you so updating the 100 to 10000 is what you think would fix the issue

tame igloo
#

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

dusky niche
#

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

tame igloo
#

Yup that should work

dusky niche
#

appreciate you Hanzo been a huge help!

tame igloo
#

Happy to help! ๐Ÿ™‚

dusky niche
#

can i send you my new pI so you can verify its working correctly

#

pi

#

pi_3PYC8jBTLjxEqPSB2bIQlrjq

tame igloo
#

You can check the request body to verify

dusky niche
#

so it succesffuly took 13 out of $100 but i dont see the 13 in the platform account balance

tame igloo
#

It will take a few days for the amount to settle (like it would for a real live mode charge)

dusky niche
#

roger