166 lines
4.7 KiB
PHP
166 lines
4.7 KiB
PHP
<?php
|
|
/**
|
|
* Demo: Payment Success / Thank-You Page
|
|
* ──────────────────────────────────────
|
|
* Where the PayPal widget sends the buyer after a successful capture.
|
|
* paypal-checkout-widget.php redirects here as:
|
|
* demo-success.php?capture_id=<PayPal capture id>
|
|
*
|
|
* In your real app you would look the capture up in your DB and show the real
|
|
* order. Here we just confirm the capture and echo the PayPal capture ID so a
|
|
* tester (e.g. PayPal support) can match it against the PayPal dashboard.
|
|
*/
|
|
|
|
$captureId = trim($_GET['capture_id'] ?? '');
|
|
$school = trim($_GET['school'] ?? '');
|
|
$valid = $captureId !== '';
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Payment <?= $valid ? 'Confirmed' : 'Status' ?> — HotLunches</title>
|
|
<style>
|
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
background: #f7f8fa;
|
|
color: #1a202c;
|
|
min-height: 100vh;
|
|
}
|
|
|
|
/* ── Top bar ── */
|
|
.topbar {
|
|
background: #fff;
|
|
border-bottom: 1px solid #e2e8f0;
|
|
padding: 14px 24px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
}
|
|
.topbar-logo { font-size: 22px; }
|
|
.topbar-name { font-weight: 700; font-size: 17px; color: #003087; }
|
|
|
|
/* ── Card ── */
|
|
.wrap { max-width: 560px; margin: 48px auto; padding: 0 20px; }
|
|
.card {
|
|
background: #fff;
|
|
border-radius: 12px;
|
|
border: 1px solid #e2e8f0;
|
|
padding: 40px 36px;
|
|
text-align: center;
|
|
}
|
|
.badge {
|
|
width: 72px; height: 72px;
|
|
border-radius: 50%;
|
|
display: flex; align-items: center; justify-content: center;
|
|
margin: 0 auto 22px;
|
|
font-size: 38px;
|
|
}
|
|
.badge.ok { background: #f0fff4; color: #38a169; border: 2px solid #c6f6d5; }
|
|
.badge.warn { background: #fffaf0; color: #dd6b20; border: 2px solid #feebc8; }
|
|
|
|
h1 { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
|
|
.sub { font-size: 15px; color: #718096; line-height: 1.6; margin-bottom: 26px; }
|
|
|
|
.detail {
|
|
background: #f7fafc;
|
|
border: 1px solid #e2e8f0;
|
|
border-radius: 10px;
|
|
padding: 16px 18px;
|
|
text-align: left;
|
|
margin-bottom: 26px;
|
|
}
|
|
.detail-row {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
gap: 12px;
|
|
padding: 6px 0;
|
|
font-size: 14px;
|
|
}
|
|
.detail-row + .detail-row { border-top: 1px solid #edf2f7; }
|
|
.detail-label { color: #718096; }
|
|
.detail-value {
|
|
font-weight: 600;
|
|
color: #1a202c;
|
|
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
word-break: break-all;
|
|
text-align: right;
|
|
}
|
|
|
|
.btn {
|
|
display: inline-block;
|
|
padding: 12px 22px;
|
|
background: #003087;
|
|
color: #fff;
|
|
border: none;
|
|
border-radius: 8px;
|
|
font-size: 15px;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
text-decoration: none;
|
|
}
|
|
.btn:hover { background: #00256b; }
|
|
.secure-note {
|
|
text-align: center; font-size: 12px; color: #a0aec0; margin-top: 20px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<nav class="topbar">
|
|
<span class="topbar-logo">🍽️</span>
|
|
<span class="topbar-name">HotLunches</span>
|
|
</nav>
|
|
|
|
<div class="wrap">
|
|
<div class="card">
|
|
|
|
<?php if ($valid): ?>
|
|
<div class="badge ok">✓</div>
|
|
<h1>Payment confirmed</h1>
|
|
<p class="sub">
|
|
Thank you! Your payment has been received and your order is confirmed.
|
|
A receipt has been sent to your email by PayPal.
|
|
</p>
|
|
|
|
<div class="detail">
|
|
<div class="detail-row">
|
|
<span class="detail-label">Status</span>
|
|
<span class="detail-value">COMPLETED</span>
|
|
</div>
|
|
<div class="detail-row">
|
|
<span class="detail-label">PayPal capture ID</span>
|
|
<span class="detail-value"><?= htmlspecialchars($captureId) ?></span>
|
|
</div>
|
|
<?php if ($school !== ''): ?>
|
|
<div class="detail-row">
|
|
<span class="detail-label">Paid to</span>
|
|
<span class="detail-value"><?= htmlspecialchars($school) ?></span>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<?php else: ?>
|
|
<div class="badge warn">!</div>
|
|
<h1>Payment status unavailable</h1>
|
|
<p class="sub">
|
|
We didn't receive a payment confirmation. If you were charged, no
|
|
capture reference was passed back to this page. Please contact support
|
|
before trying again so you aren't billed twice.
|
|
</p>
|
|
<?php endif; ?>
|
|
|
|
<a class="btn" href="demo-product.php<?= $school !== '' ? '?school=' . urlencode($school) : '' ?>">
|
|
← Back to store
|
|
</a>
|
|
|
|
<p class="secure-note">🔒 Payments processed securely by PayPal</p>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|