#zeke_code
1 messages · Page 1 of 1 (latest)
👋 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.
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.
- zeke_best-practices, 8 hours ago, 6 messages
- zeke_code, 23 hours ago, 16 messages
- zeke_code, 1 day ago, 18 messages
- zeke_error, 1 day ago, 10 messages
- zeke_best-practices, 2 days ago, 8 messages
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,
},
});
You would need to calculate that on your own and then set the amount to an integer
Not that great at math so this should be fun 🫡
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
`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 🫡
Yeah so how can I give you a raise
You've already raised my spirits (though that could also be the caffeine kicking in)