{{ phrase('crypto_payment_checkout') }} {{ phrase('purchase') }}

{{ phrase('crypto_payment_instructions') }}

{{ phrase('scan_qr_to_pay') }}

{{ phrase('amount_to_send') }}

{{ $amount }}

{{ phrase('send_to_address') }}

{{ phrase('transaction_id') }}

{{ $transactionId }}

{{ phrase('time_remaining') }}

{{ phrase('payment_status') }}

{{ phrase('waiting_for_payment') }}
{{ phrase('cancel') }}

{{ phrase('need_help') }}

{{ phrase('crypto_payment_help_text') }}

// Copy button functionality if ($('.js-copyButton').length) { var clipboard = new Clipboard('.js-copyButton'); clipboard.on('success', function(e) { XF.flashMessage(XF.phrase('address_copied_to_clipboard'), 1500); }); } // Initialize countdown timer var timeoutMinutes = {{ \XF::options()->cryptoPaymentTimeoutMinutes ?: 30 }}; var endTime = new Date(); endTime.setMinutes(endTime.getMinutes() + timeoutMinutes); function updateCountdown() { var now = new Date(); var diff = endTime - now; if (diff <= 0) { document.getElementById('crypto-countdown').textContent = XF.phrase('time_expired'); document.getElementById('crypto-status').textContent = XF.phrase('payment_expired'); document.getElementById('crypto-status').classList.add('crypto-status--expired'); clearInterval(countdownInterval); return; } var minutes = Math.floor(diff / 1000 / 60); var seconds = Math.floor((diff / 1000) % 60); document.getElementById('crypto-countdown').textContent = minutes.toString().padStart(2, '0') + ':' + seconds.toString().padStart(2, '0'); } var countdownInterval = setInterval(updateCountdown, 1000); updateCountdown(); // Check payment status $('#crypto-check-status').on('click', function() { var $button = $(this); var $statusContainer = $('#crypto-status'); $button.addClass('is-disabled').prop('disabled', true); $statusContainer.html(' ' + XF.phrase('checking')); XF.ajax('post', XF.canonicalizeUrl('index.php?crypto-payments/check-status'), { transaction_id: '{{ $transactionId }}', _xfToken: XF.config.csrf }, function(data) { $button.removeClass('is-disabled').prop('disabled', false); if (data.status) { $statusContainer.text(data.statusText); if (data.status === 'completed') { $statusContainer.addClass('crypto-status--completed'); XF.flashMessage(XF.phrase('payment_completed'), 3000); // Redirect to success URL after a brief delay setTimeout(function() { window.location.href = data.redirectUrl; }, 3000); } else if (data.status === 'pending') { $statusContainer.addClass('crypto-status--pending'); } else if (data.status === 'timed-out') { $statusContainer.addClass('crypto-status--expired'); clearInterval(countdownInterval); } } else { XF.flashMessage(XF.phrase('error_checking_status'), 3000); } } ); }); // Auto-check status periodically var statusCheckInterval = setInterval(function() { if (!document.getElementById('crypto-check-status').disabled) { $('#crypto-check-status').click(); } }, 30000); // Check every 30 seconds // Clear intervals when leaving the page $(window).on('beforeunload', function() { clearInterval(countdownInterval); clearInterval(statusCheckInterval); });