'Monthly Lunch Plan — October', 'qty' => 1, 'price' => 95.00, 'emoji' => '🍱'], ['name' => 'Morning Snack Pack × 20 days', 'qty' => 1, 'price' => 28.00, 'emoji' => '🥐'], ['name' => 'Juice Box Bundle × 20 days', 'qty' => 1, 'price' => 14.00, 'emoji' => '🧃'], ]; $currency = 'USD'; // ── End of real-app variables ───────────────────────────────────────────────── // Calculate total + build PayPal line items $total = 0.0; $ppItems = []; foreach ($cartItems as $item) { $lineTotal = $item['price'] * $item['qty']; $total += $lineTotal; $ppItems[] = [ 'name' => $item['name'], 'quantity' => (string)$item['qty'], 'unit_amount' => ['currency_code' => $currency, 'value' => number_format($item['price'], 2, '.', '')], ]; } $ppCheckout = [ 'school_name' => $schoolLabel, 'amount' => number_format($total, 2, '.', ''), 'currency' => $currency, 'items' => $ppItems, 'buyer_email' => $buyerEmail, 'page_type' => 'cart', // tells PayPal this is a cart page 'order_api_url' => './order-api.php', 'success_url' => './demo-success.php?school=' . urlencode($schoolLabel), 'cancel_url' => './demo-cart.php', ]; ?>
?school=<connected school name>.
🔒 Secured by PayPal