Update deposit intent to log stripeAmount and use it for payment creation
This commit is contained in:
@@ -27,8 +27,9 @@ router.post('/api/wallet/deposit-intent', authMiddleware, async (req, res) => {
|
|||||||
|
|
||||||
const rawAmount = req.body.amount;
|
const rawAmount = req.body.amount;
|
||||||
const amount = Math.round(Number(rawAmount));
|
const amount = Math.round(Number(rawAmount));
|
||||||
|
const stripeAmount = Math.round(amount * 100);
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
console.log('Stripe deposit request:', { rawAmount, amount, min: MIN_DEPOSIT, max: MAX_DEPOSIT });
|
console.log('Stripe deposit request:', { rawAmount, amount, stripeAmount, min: MIN_DEPOSIT, max: MAX_DEPOSIT });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Number.isFinite(amount) || amount < MIN_DEPOSIT || amount > MAX_DEPOSIT) {
|
if (!Number.isFinite(amount) || amount < MIN_DEPOSIT || amount > MAX_DEPOSIT) {
|
||||||
@@ -36,7 +37,7 @@ router.post('/api/wallet/deposit-intent', authMiddleware, async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const paymentIntent = await stripe.paymentIntents.create({
|
const paymentIntent = await stripe.paymentIntents.create({
|
||||||
amount,
|
amount: stripeAmount,
|
||||||
currency: 'huf',
|
currency: 'huf',
|
||||||
automatic_payment_methods: { enabled: true },
|
automatic_payment_methods: { enabled: true },
|
||||||
metadata: {
|
metadata: {
|
||||||
|
|||||||
Reference in New Issue
Block a user