=== Scratch Card AI ===
Contributors: scratchcardai
Tags: scratch card, custom popup, customer engagement
Tested up to: 6.8
Requires at least: 5.8
Requires PHP: 7.4
Stable tag: 1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Donate link: https://buymeacoffee.com/scratchcardai

A WordPress plugin that allows vendors to create digital scratch cards and engage users through a gamified popup or homepage experience.

== Description ==

Scratch Card is an interactive WordPress plugin designed to boost user engagement and collect valuable customer data. Seamlessly integrated with the [Scratch Card AI](https://scratchcardai.com) system, this plugin enables vendors to display digital scratch cards using either:

- A **popup** on any page  
- A **custom homepage template** embedding the scratch card as an iframe

**Note:**  
Registration is free at [scratchcardai.com](https://scratchcardai.com). After registration, navigate to the **Implementation** section in the dashboard and copy your **License Key** to activate the plugin.

**Key Features:**

- Create digital scratch cards on your WordPress site  
- Choose between **popup** mode or **custom homepage embedding**  
- Collect user data such as name, email, etc.  
- Fully responsive design, mobile-ready  
- OTP verification and license key integration  
- Easy-to-use admin interface with preview and disconnect options  

**Short Description:**  
Engage visitors with digital scratch cards using a popup or custom homepage. Easily connect to your Scratch Card AI account.

== Installation ==

1. Upload the `scratch-card` plugin folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the “Plugins” menu in WordPress.
3. Go to **Scratch Card > Admin Page** from the WordPress sidebar.
4. Register or Sign In using your [Scratch Card AI](https://scratchcardai.com) account.
5. Copy your License Key from the **Implementation** section.
6. Enter your License Key and choose between **popup** or **homepage template** mode.
7. Save and verify via OTP.
8. For **popup mode**, add the class `open-scratchcard-modal` to any button or link on your site to trigger the scratch card popup.  
   _Example:_  
   `<button class="open-scratchcard-modal">Open Modal</button>`
9. You're ready to go!

== Frequently Asked Questions ==

= What are the display options? =
You can choose between:
- A popup that appears on your existing pages
- A custom homepage template that embeds the scratch card experience directly via iframe

= How do I trigger the popup manually? =
If you're using **popup mode**, simply add the class `open-scratchcard-modal` to any HTML element like a button or anchor.  
Example: `<a class="open-scratchcard-modal">Try Your Luck</a>`

= Is OTP verification required? =
Yes. After entering your license key, you will receive a one-time password (OTP) to verify your integration.

= Can I switch from popup to homepage mode later? =
Yes, simply disconnect and reconnect using the admin panel and choose the new display type.

== External Services ==

This plugin integrates with the [Scratch Card AI](https://scratchcardai.com) platform to enable digital scratch card functionality.

**External API Calls:**

1. `https://scratchcardai.com/api/get-user-key/{license-key}`  
   - This call is made when a user enters their license key.  
   - Purpose: To retrieve an OTP ID for account verification.

2. `https://scratchcardai.com/api/verify-user-otp/{otp-id}/{otp-value}`  
   - This call is made when the user submits the OTP during license verification.  
   - Purpose: To verify that the user owns the license key and has entered the correct OTP.

**Data Sent:**
- The plugin sends the following information:
  - **License Key** (user input from admin form)
  - **OTP characters** (user input during verification)

**Why it's sent:**
- This data is used to authenticate users and retrieve the JavaScript embed code for their scratch card.

**Service Provider:**
- **Scratch Card AI** – a digital gamification platform  
  - **Website:** https://scratchcardai.com  
  - **Privacy Policy:** https://scratchcardai.com/privacy-policy

== Screenshots ==

1. Scratch Card plugin setup in the admin dashboard
2. OTP verification screen
3. Popup scratch card in action

== Changelog ==

= 1.0 =
* Initial public release  
* Option to embed scratch card via homepage iframe  
* Enhanced UI styling and mobile responsiveness  
* OTP popup with auto-focus  
* Added support for manual trigger via `.open-scratchcard-modal` class

== Upgrade Notice ==

= 1.0 =
Initial release. Supports both popup and homepage scratch card display. Compatible with WordPress 6.7+.
