diff --git a/resources/views/north_checkout.blade.php b/resources/views/north_checkout.blade.php
index 2e49af1..54a18dc 100644
--- a/resources/views/north_checkout.blade.php
+++ b/resources/views/north_checkout.blade.php
@@ -26,6 +26,7 @@
+
+
+
Still here?
+
If you have already completed your payment but the page hasn't redirected, please click the button below.
+
+ Verify Payment Status
+
+
@@ -67,19 +75,52 @@
return;
}
+ // Set up fallback button
+ const verifyUrl = `/north/verify/${bidderId}?sessionToken=${sessionToken}`;
+ const verifyButton = document.getElementById('verify-button');
+ const fallbackContainer = document.getElementById('fallback-container');
+ verifyButton.href = verifyUrl;
+
+ // Show fallback after 5 seconds to give user a manual way out if auto-redirect fails
+ setTimeout(() => {
+ fallbackContainer.style.display = 'block';
+ }, 5000);
+
await checkout.mount(sessionToken, 'checkout-container');
const handleCompletion = (result) => {
- window.location.href = `/north/verify/${bidderId}?sessionToken=${sessionToken}`;
+ console.log('Payment complete event received:', result);
+ window.location.href = verifyUrl;
};
+ // Register standard completion events
checkout.onPaymentComplete(handleCompletion);
if (typeof checkout.onPaymentSuccess === 'function') {
checkout.onPaymentSuccess(handleCompletion);
}
+
+ // Handle errors
+ if (typeof checkout.onPaymentError === 'function') {
+ checkout.onPaymentError((error) => {
+ console.error('Payment Error:', error);
+ const errorDiv = document.createElement('div');
+ errorDiv.className = 'alert alert-danger alert-dismissible';
+ errorDiv.innerHTML = `
+
+
+
+ Payment Error: ${error.message || 'An error occurred during payment.'}
+
+
+
+ `;
+ document.getElementById('payment-error-container').prepend(errorDiv);
+ });
+ }
+
} catch (error) {
console.error('Checkout Error:', error);
- document.getElementById('checkout-container').innerHTML = '
An error occurred. Please try again.
';
+ document.getElementById('checkout-container').innerHTML = '
An error occurred while initializing checkout. Please try again.
';
}
});