#Hitesh

1 messages · Page 1 of 1 (latest)

sour mossBOT
quasi cloak
#

here is my code snippet

#

const totalAmountCents = 10000;
const creditCardProcessingFeeCents = Math.round(
totalAmountCents * 0.029 + 30,
);
const platformFeeCents = Math.round(totalAmountCents * 0.05);
const applicationFeeAmountCents =
creditCardProcessingFeeCents + platformFeeCents;
const stripeUnitAmount = totalAmountCents + applicationFeeAmountCents;
const checkoutSession = await stripe.checkout.sessions.create({
mode: 'payment',
line_items: [
{
price_data: {
product_data: {
name: '1A',
},
currency: 'eur',
unit_amount_decimal: String(stripeUnitAmount),
},
quantity: 1,
},
],

success_url: 'http://localhost:3000/payment/success',
cancel_url: 'http://localhost:3000/payment/cancel',
payment_intent_data: {
application_fee_amount: applicationFeeAmountCents,
transfer_data: {
destination: account id,
},
},
});

#

the main stripe balance goes negative

dense drum
#

Hi! Let me help you with this.

#

Could you please share the PaymentIntent ID pi_xxx?

quasi cloak
#

pi_3N68z0FEVJEbpeYB1kw9yHsq

#

i have balance 97.86 and after successful transaction goes balance to negative 94.61

#

?

dense drum
#

Sorry for delay, it's busy today. Let me check.

quasi cloak
#

ok

dense drum
#

Why are you using unit_amount_decimal: "10345", when creating the checkout session, and not unit_amount?

#

You are transfering the amount of 10345 which is $103.45, but unit_amount_decimal: "10345" is actually $10345. However, I'm still not sure why this results in negative balance.

quasi cloak
#

i am also not sure why balance goes negative

#

i have tried with both unit_amount as well as unit_amount_decimal

#

is their any charges on currency based

#

because the amount collected is in EURO

#

?

dense drum
#

I see your balance is positive. Or are you talking about the connected account?

quasi cloak
#

this is the transaction of checkout session

dense drum
#

What do you mean?

quasi cloak
#

like in previous image the fees amount is 3.39

#

so 3.39 will be deducted from the main stripe balance

#

write now the stripe balance is 91.22 which is before transaction is 94.61

dense drum
#

Oh, I thought you mean a negative (-)91.22 balance.

#

You can use the application_fee_amount to have the connected account pay for this.

quasi cloak
#

yes, you are correct every time the amount id deducted from main stripe balance

#

const totalAmountCents = 10000;
const creditCardProcessingFeeCents = Math.round(
totalAmountCents * 0.029 + 30,
);
const platformFeeCents = Math.round(totalAmountCents * 0.05);
const applicationFeeAmountCents =
creditCardProcessingFeeCents + platformFeeCents;
const stripeUnitAmount = totalAmountCents + applicationFeeAmountCents;
const checkoutSession = await stripe.checkout.sessions.create({
mode: 'payment',
line_items: [
{
price_data: {
product_data: {
name: '1A',
},
currency: 'eur',
unit_amount_decimal: String(stripeUnitAmount),
},
quantity: 1,
},
],

success_url: 'http://localhost:3000/payment/success',
cancel_url: 'http://localhost:3000/payment/cancel',
payment_intent_data: {
application_fee_amount: applicationFeeAmountCents,
transfer_data: {
destination: account id,
},
},
});

#

i have already used application_fee_amount

#

?

dense drum
#

Alternatively, you can specify the transfer_data.amount that = total - service_fee

quasi cloak
#

let me try