#joseamica

1 messages · Page 1 of 1 (latest)

golden cliffBOT
pulsar bolt
#

Hi 👋 are you referring to Stripe's fees? If so, I'd recommend reaching out to our Support team:
https://support.stripe.com/?contact=true

If you're talking about charging fees as part of your integration, can you elaborate?

bleak wind
#

Hi toby, I am developing a payment solution for restaurants in which the clients can pay the bill or split the bill. Of course im using stripe, but i dont know if the code is not good.

#

This is my createPaymentIntent function on my backend:

const createPaymentIntent = async (req, res) => {
  const { amounts, customerId, currency, paymentMethodId, params } = req.body
  console.log(amounts)
  const rest_fee = amounts.total * 0.02
  try {
    const paymentIntent = await stripe.paymentIntents.create({
      customer: customerId,
      amount: amounts.total - rest_fee,
      currency: currency,
      payment_method: paymentMethodId,
      setup_future_usage: 'off_session',
      application_fee_amount: amounts.avoFee + rest_fee,
      transfer_data: {
        destination: 'acct_1Oks58PmsglnVXF2',
      },
      metadata: {
        venueId: params.venueId,
        billId: params.billId,
        tipPercentage: amounts.tipPercentage,
        avoFee: amounts.avoFee,
        total: amounts.total,
        amount: amounts.amount,
      },
    })

    res.json({ id: paymentIntent.id, client_secret: paymentIntent.client_secret })
  } catch (err) {
    console.log(err)
    res.status(500).json('Error creating payment intent')
  }
}

I just want to know what is going on here, because the numbers doesnt match

pulsar bolt
#

Can you provide more details? What numbers are you looking at that don't match, where did those come from?

bleak wind
#

Well i provide them

#

I need to charge to the restaurant a 2% fee for every transaction, additionaly to 0.5% to the user.

#
  if (amount.amount / 100 < 10) {
    return <div>El monto mínimo es de $10</div>
  }

  const tip = amount.amount * tipPercentage
  const avoFee = amount.amount * 0.05
  const total = Math.round(amount.amount + tip + avoFee)
pulsar bolt
#

Okay, and what are you seeing currently? How is that different from what you're expecting? I need more details about specific numbers you're seeing, and expecting to see, in order to help provide any guidance on why those don't align. Right now I have the code you're using to create a Payment Intent, but I don't grasp why that isn't doing what you're hoping.

bleak wind
#

Example the bill is 100 usd
the user wants to give a tip of 20% (20 usd)
avofee is currently in 5% but it would be 2% = 2 usd

subtotal 122 usd + the 0.5% = 0.61 usd

Total: 122.61

#

For some reason, the stripe fees are always bigger and im always losing money..