WORDFLIP: SETUP GUIDE
=====================

Inside this zip is a folder called public_html. Its contents are your whole website.


STEP 1: UPLOAD THE FILES (cPanel → File Manager)
-----------------------------------------------
1. Open File Manager and go into the folder for wordflip.ai
   (public_html, or the folder cPanel created when you added wordflip.ai as a domain).
2. Click Upload and upload wordflip-site.zip.
3. Right-click the zip → Extract.
4. Move everything from the extracted "public_html" folder into the wordflip.ai folder,
   so that index.php sits directly inside it. (Turn on "Show Hidden Files" in
   File Manager Settings so the .htaccess files move too.)


STEP 2: FILL IN YOUR SETTINGS
-----------------------------
1. Open the "app" folder.
2. Copy config.sample.php and name the copy config.php.
3. Right-click config.php → Edit, and fill in:
   - db_dsn / db_user / db_pass: your database name, user and password from
     cPanel → MySQL Databases (they look like twitujfu74urx_wordflip).
   - lynote_api_key: your NEW Lynote key (delete the one you pasted in chat
     and create a fresh one first).
   - install_key: make up a long random password.
   - legal_name: your legal name or company name (shows on Terms/Privacy).
   - Leave the Stripe values for now (Step 5).
4. Save.


STEP 3: CREATE THE DATABASE TABLES
----------------------------------
1. Visit:  https://wordflip.ai/install?key=YOUR_INSTALL_KEY
2. You should see "Done! Database tables are ready."
3. Delete install.php from File Manager.


STEP 4: TEST IT
---------------
1. Open https://wordflip.ai and press "Flip it". You should get a real rewrite.
2. Create an account, try each tool from the dashboard.
3. If something says "Something went wrong on our side", check
   cPanel → Errors (or the error_log file in your site folder). Lines starting
   with [wordflip] say exactly what happened.


STEP 5: TURN ON PAYMENTS (Stripe)
---------------------------------
1. Stripe → Product catalog → Add product "Wordflip Pro" with two prices:
   $9.99 monthly, and $71.88 yearly. Add "Wordflip Max": $19.99 monthly, and
   $143.88 yearly.
2. Copy each price ID (starts with price_) into stripe_prices in config.php.
3. Stripe → Developers → API keys: copy the Secret key into stripe_secret_key.
4. Stripe → Developers → Webhooks → Add endpoint:
      URL:    https://wordflip.ai/webhook
      Events: checkout.session.completed, customer.subscription.created,
              customer.subscription.updated, customer.subscription.deleted
   Copy the Signing secret (whsec_...) into stripe_webhook_secret.
5. Stripe → Settings → Billing → Customer portal: turn it on and allow
   cancelling and switching plans (Pro/Max).
6. Test first in Stripe's Test mode with card 4242 4242 4242 4242, then switch
   to your live keys and live price IDs.


STEP 6: EMAIL
-------------
cPanel → Email Accounts: create noreply@wordflip.ai and support@wordflip.ai
so password-reset emails send and customers can reach you.


ADDING REAL REVIEWS LATER
-------------------------
Open index.php, find  $reviews = [];  near the top and add real ones from real
users (with their permission). The reviews section appears automatically.


CHANGING PRICES OR LIMITS
-------------------------
Word limits: app/plans.php (WF_PLANS). Displayed prices: WF_PRICES in the same
file. Real charges come from Stripe, so change both together.
