CMS Pharmacy Billing Pro Connector
Version 1.0.0

INSTALL
1. WordPress Admin > Plugins > Add New Plugin > Upload Plugin.
2. Upload this ZIP and activate it.
3. Open WordPress Dashboard > Billing Pro Sync.
4. Enable sync and copy the Site Sync Token.
5. In CMS Pharmacy Billing Pro > Website Sync, enter the HTTPS website URL and save.
6. Press Sync Now / Test once.
7. Create a WordPress page with slug weekly-stock. The plugin automatically appends the latest report to that page. If you want a different page slug, add [cms_billing_stock] to the page content instead; do not do both on the same page.
8. Configure Hostinger cron to call billing_v2/cron_weekly_sync.php every Monday using the BACKUP_CRON_TOKEN. The worker only sends stock for active, unexpired subscriptions.

FEATURES
- Authenticated REST endpoint: /wp-json/cms-billing/v1/weekly-stock
- Header: X-CMS-Billing-Token
- Stores latest stock and up to 12 weekly snapshots.
- Creates CSV under wp-content/uploads/cms-billing-stock/.
- Shortcode: [cms_billing_stock]

SECURITY / LIMITS
- Use HTTPS only. Keep the token private.
- Weekly sync is sent by the billing server cron; WordPress does not fetch billing data by itself.
- Stock report is public when shown on a public page and may include batch, expiry and quantity. Review this before publishing.
- The HTML/PHP package has only been statically tested. Test on a staging website and complete a Cashfree Sandbox payment before production.

COMPATIBILITY FIXES
- Admin token input is submitted as part of the settings form so saving settings does not rotate the token unexpectedly.
- The shortcode [cms_billing_stock] can be used on a WordPress page. Auto-append to the weekly-stock slug avoids duplicate output when the shortcode is already in the page content.
- Public stock report is intended to be public; review batch/expiry/quantity disclosure before enabling.
