#Hitesh
1 messages · Page 1 of 1 (latest)
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
pi_3N68z0FEVJEbpeYB1kw9yHsq
i have balance 97.86 and after successful transaction goes balance to negative 94.61
?
Sorry for delay, it's busy today. Let me check.
ok
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.
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
?
I see your balance is positive. Or are you talking about the connected account?
this is the transaction of checkout session
What do you mean?
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
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.
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
?
Alternatively, you can specify the transfer_data.amount that = total - service_fee
let me try