quantumpay-demo / confirmation.js
jhgtfrdefghj's picture
it's not working??
38738e2 verified
document.addEventListener('DOMContentLoaded', function() {
// Get URL parameters
const urlParams = new URLSearchParams(window.location.search);
const amount = urlParams.get('amount');
const currency = urlParams.get('currency');
// DOM Elements
const sendAmountEl = document.getElementById('sendAmount');
const sendCurrencyEl = document.getElementById('sendCurrency');
const receiveAmountEl = document.getElementById('receiveAmount');
const receiveCurrencyEl = document.getElementById('receiveCurrency');
const summaryAmountEl = document.getElementById('summaryAmount');
const summaryCurrencyEl = document.getElementById('summaryCurrency');
const exchangeRateEl = document.getElementById('exchangeRate');
const totalReceiveEl = document.getElementById('totalReceive');
const confirmPaymentBtn = document.getElementById('confirmPayment');
// Display the transaction details
if (amount && currency) {
// For demo purposes, we'll use a fixed exchange rate
// In a real application, you would fetch this from an API
const exchangeRates = {
'USDT': 1.00,
'BNB': 300.00,
'BTC': 45000.00,
'SOL': 100.00
};
const rate = exchangeRates[currency] || 1.00;
const receiveAmount = (amount / rate).toFixed(6);
// Update UI
sendAmountEl.textContent = `${amount}`;
sendCurrencyEl.textContent = currency;
receiveAmountEl.textContent = `${receiveAmount}`;
receiveCurrencyEl.textContent = currency;
summaryAmountEl.textContent = `${amount}`;
summaryCurrencyEl.textContent = currency;
exchangeRateEl.textContent = `1 ${currency} = ${rate.toFixed(2)} USD`;
totalReceiveEl.textContent = `${amount}`;
}
// Confirm payment button
confirmPaymentBtn.addEventListener('click', function() {
// Show confirmation message
alert('Payment confirmed! In a real application, this would process the transaction.');
// Redirect to success page or back to home
window.location.href = 'index.html';
});
});