============================================================
STANDARD COLLEGE GUEST BILLING PORTAL
Setup Guide for Namecheap cPanel Hosting
============================================================

FILES IN THIS PACKAGE:
-----------------------
index.php     — Main billing/plans page (guests land here)
verify.php    — Payment verification + MikroTik access grant
webhook.php   — Paystack webhook handler (backup confirmation)
success.php   — Success page after payment
README.txt    — This file

STEP 1 — ENABLE MIKROTIK API
------------------------------
In MikroTik terminal run:
  /ip service enable api
  /ip service set api port=8728

Also allow API through firewall:
  /ip firewall filter add chain=input protocol=tcp dst-port=8728 src-address=YOUR_SERVER_IP action=accept comment="Allow API from billing server"

STEP 2 — EDIT verify.php
--------------------------
Open verify.php and update these lines:

  define('PAYSTACK_SECRET_KEY', 'sk_live_YOUR_LIVE_SECRET_KEY');
  define('MIKROTIK_HOST',       '192.168.88.1');
  define('MIKROTIK_USER',       'admin');
  define('MIKROTIK_PASSWORD',   'YourStrongPassword123!');

STEP 3 — EDIT index.php
-------------------------
Open index.php and find this line:
  key: 'pk_test_YOUR_PAYSTACK_PUBLIC_KEY_HERE',

Replace with your actual Paystack public key:
  key: 'pk_live_YOUR_LIVE_PUBLIC_KEY',

STEP 4 — UPLOAD TO NAMECHEAP
------------------------------
1. Login to cPanel → File Manager
2. Navigate to: public_html/
   (or your subdomain folder if using internet.standardnursingsciencesmx.com)
3. Upload ALL files to that folder
4. Create a folder called: logs/
5. Set logs/ permissions to 755

STEP 5 — SET PAYSTACK WEBHOOK
-------------------------------
1. Login to dashboard.paystack.com
2. Go to Settings → API Keys & Webhooks
3. Set webhook URL to:
   https://internet.standardnursingsciencesmx.com/webhook.php

STEP 6 — CONFIGURE MIKROTIK HOTSPOT REDIRECT
----------------------------------------------
In MikroTik terminal:
  /ip hotspot profile set hsprof4 login-by=http-chap login-page=http://internet.standardnursingsciencesmx.com/

STEP 7 — TEST
--------------
1. Connect a phone to the Guest WiFi SSID
2. Open browser — should redirect to billing page
3. Select a plan
4. Use Paystack test card: 4084 0840 8408 4081, CVV: 408, Expiry: 01/25
5. Complete payment
6. Should get internet access automatically

BILLING PLANS:
--------------
Basic    — 1GB   — ₦250  — 24 hours
Standard — 2GB   — ₦300  — 24 hours
Premium  — 3.5GB — ₦500  — 24 hours
Ultimate — 5GB   — ₦1000 — 24 hours

SUPPORT:
--------
Check logs/ folder for payment and error logs.
payments.log — all payment attempts
webhook.log  — Paystack webhook events

============================================================
