diff --git a/src/components/GpuPaymentModal.tsx b/src/components/GpuPaymentModal.tsx index f13ce28..be5ab06 100644 --- a/src/components/GpuPaymentModal.tsx +++ b/src/components/GpuPaymentModal.tsx @@ -424,6 +424,8 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps) setLoading(true); setErrorMsg(null); setSuccessMsg(null); + + let priceUsd = selectedToken === "VERTEX" ? gpu.price_usd * 0.9 : gpu.price_usd; try { if (!userEmail || !isValidEmail(userEmail)) { @@ -475,7 +477,8 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps) tokenPrice = customTokenPrice || 0.5; } - const tokenAmount = (gpu.price_usd / tokenPrice).toFixed(tokenDecimals); + const priceUsd = selectedToken === "VERTEX" ? gpu.price_usd * 0.9 : gpu.price_usd; + const tokenAmount = (priceUsd / tokenPrice).toFixed(tokenDecimals); amountDisplay = `${tokenAmount} ${selectedToken}`; // Get or create token accounts using the correct method @@ -540,7 +543,7 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps) email: userEmail, product: gpu.title, price_hour: gpu.price_per_hour, - price: gpu.price_usd.toFixed(2) + price: priceUsd.toFixed(2) }); const generatedOrderId = `${Math.floor(Math.random() * 900) + 100}-${Math.floor(Math.random() * 900) + 100}-${Math.floor(Math.random() * 900) + 100}`; @@ -550,7 +553,7 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps) { gpu: `${gpu.id} ${gpu.title}`, user_email: userEmail, - amount_usd: gpu.price_usd, + amount_usd: priceUsd, token_used: tokenUsed, token_amount: amountDisplay, token_tx_signature: txId, @@ -573,7 +576,7 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps) { gpu: `${gpu.id} ${gpu.title}`, user_email: userEmail, - amount_usd: gpu.price_usd, + amount_usd: priceUsd, token_used: selectedToken, status: "failed", error_message: err.message || "Unknown error", @@ -593,6 +596,10 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps) }; if (!isOpen) return null; + const displayPrice = selectedToken === 'VERTEX' + ? (gpu.price_usd * 0.9).toFixed(2) + : gpu.price_usd.toFixed(2); + // Show failure screen if payment failed if (paymentFailure) { @@ -725,7 +732,7 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
Total Price
- ${gpu.price_usd} + ${displayPrice} (~{currentTokenAmount} {selectedToken})