#zeke_code

1 messages · Page 1 of 1 (latest)

hearty garnetBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always 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/1268239944107692073

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

timber crowBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

tribal monolith
#

It cut some of the code provided so here is the full code

const applicationFeeAmount = 0.10; // 10% fee

    const stripeSession = await stripe.checkout.sessions.create({
      success_url: `${process.env.NEXT_PUBLIC_SERVER_URL}/thank-you?orderId=${order.id}`,
      cancel_url: `${process.env.NEXT_PUBLIC_SERVER_URL}/cart`,
      payment_method_types: ["card"],
      mode: "payment",
      metadata: {
        userId: user.id,
        orderId: order.id,
      },
      line_items: line_items,
      payment_intent_data: {
        application_fee_amount: applicationFeeAmount,
      },
    });
unborn jacinth
#

You would need to calculate that on your own and then set the amount to an integer

tribal monolith
#

Not that great at math so this should be fun 🫡

unborn jacinth
#

Same tho

#

🫡

tribal monolith
#

So your saying I need to calculate the 10% into an integer?

#

🫡

unborn jacinth
#

Yup. So once you have your number, let's say 7.3948, you would round to the nearest 10th (e.g. 7.39) and then drop the decimal and send that --> application_fee_amount: 739

tribal monolith
#

ok ill try it

#

this might take me longer than centering a div

unborn jacinth
#

`applicationFeeAmount = 0.10 * <some amount>
num = Math.round((applicationFeeAmount + Number.EPSILON) * 100)

const stripeSession = await stripe.checkout.sessions.create({
success_url: ${process.env.NEXT_PUBLIC_SERVER_URL}/thank-you?orderId=${order.id},
cancel_url: ${process.env.NEXT_PUBLIC_SERVER_URL}/cart,
payment_method_types: ["card"],
mode: "payment",
metadata: {
userId: user.id,
orderId: order.id,
},
line_items: line_items,
payment_intent_data: {
application_fee_amount: num
},
});`

#

Godspeed, good sir 🫡

tribal monolith
#

Yeah so how can I give you a raise

unborn jacinth
#

You've already raised my spirits (though that could also be the caffeine kicking in)