=== CodeCasa SMS Marketing ===
Contributors: codecasastudios
Tags: woocommerce, sms, order notifications, two factor authentication, password reset
Requires at least: 5.0
Tested up to: 6.6
Requires PHP: 7.4
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

SMS for WooCommerce order updates, account security codes, password reset links, shortlinks, delivery logs, and subscription billing.

== Description ==

CodeCasa SMS Marketing adds SMS messaging tools to WooCommerce stores.

The plugin connects your WordPress site to the hosted CodeCasa SMS service so your store can send operational SMS messages, manage monthly SMS subscriptions, view message logs, and use customer account security features from inside WordPress.

Setup is designed to be simple:

* Install the plugin.
* Enter your store details.
* Verify your UK mobile number by SMS.
* Choose a monthly SMS subscription.
* Turn on the WooCommerce SMS messages you want to send.

= Features =

* Send SMS when WooCommerce orders move to processing, completed, on hold, cancelled, or refunded.
* Send SMS when a customer-visible order note is added.
* Built-in customer account SMS two-factor authentication.
* Optional SMS password reset messages.
* Automatic shortlinks for supported account, order, and reset links.
* UK mobile number validation for setup and customer account security flows.
* Optional store name prefixing for outgoing SMS messages.
* Message logs with SMS status, recipient, message type, send time, and credits used.
* Monthly subscription plan selection from inside WordPress.
* Billing portal access, plan upgrades, cancellation controls, and auto top-up controls.
* Optional auto top-up: add 100 SMS credits when balance reaches 10 credits.

= External Services =

This plugin connects to external services because SMS sending, verification, subscription billing, delivery logs, and shortlinks are provided through hosted services rather than only inside your WordPress installation.

The plugin sends data to the CodeCasa SMS API. By default the plugin uses `https://backend-one-navy-66.vercel.app/api`. If a site owner defines `SMS_CODECASA_API_URL` or saves a different API URL, the plugin uses that configured URL instead.

The CodeCasa SMS API is used when:

* You submit the onboarding form.
* You verify your mobile number by SMS.
* You request available subscription plans.
* You start Stripe checkout from the plugin.
* You view dashboard balance, subscription, billing, and message log data.
* You save plugin SMS settings.
* The plugin sends an SMS for an order event, customer note, two-factor authentication code, password reset message, verification code, manual message, or other enabled SMS flow.
* You open billing details, change plan, cancel subscription, or update auto top-up settings.

Depending on the action, the plugin may send:

* Site URL and store name.
* Administrator email address.
* Verification mobile number.
* Authentication token issued by CodeCasa after verification.
* WooCommerce order ID, order status, customer name, billing phone number, account URL, site URL, customer note text, and generated message content.
* WordPress user ID where needed for account security messages.
* SMS settings and message templates.
* Subscription plan ID, billing return URLs, and auto top-up preference.

CodeCasa SMS uses this data to provide the SMS service, verify store access, create and manage subscription billing, send messages, maintain logs, process delivery status, deduct SMS credits, and provide support.

Service terms: https://sendsmstoday.com/terms.html
Privacy policy: https://sendsmstoday.com/privacy.html

Payments and billing are handled by Stripe. When you choose a subscription, manage billing, upgrade, cancel, or use auto top-up, billing-related data is processed by Stripe.

Stripe privacy policy: https://stripe.com/us/privacy
Stripe services agreement: https://stripe.com/legal/ssa
Stripe Privacy Center: https://stripe.com/en-gb-us/legal/privacy-center

Shortlinks are created through the CodeCasa shortlink service at `https://shrt.codes/api/shorten` when a supported SMS message contains a URL. The original URL is sent to the shortlink service so a short URL can be created for use in the SMS.

Shortlink service: https://shrt.codes
Shortlink terms: https://sendsmstoday.com/terms.html
Shortlink privacy policy: https://sendsmstoday.com/privacy.html

== Installation ==

1. Upload the plugin ZIP through Plugins > Add New > Upload Plugin.
2. Activate the plugin.
3. Open the SMS Marketing menu in WordPress admin.
4. Complete the setup wizard.
5. Verify your UK mobile number using the SMS code.
6. Select a monthly SMS subscription.
7. Configure your SMS triggers and message templates.

== Frequently Asked Questions ==

= Do I need API keys? =

No. The plugin uses the CodeCasa SMS setup wizard and account verification flow. You do not need to paste API keys into WordPress.

= Does this work with WooCommerce? =

Yes. The plugin is built for WooCommerce order status messages, customer notes, billing phone collection, and My Account security flows.

= Can customers receive two-factor authentication codes by SMS? =

Yes. Customer account SMS two-factor authentication can be turned on from the plugin settings.

= Can customers receive password reset links by SMS? =

Yes. Password reset SMS messages can be enabled from the plugin settings.

= Are shortlinks included? =

Yes. Supported URLs in SMS messages can be shortened automatically.

= What happens when the SMS balance gets low? =

Auto top-up is on by default for active subscriptions. When enabled, if the SMS balance reaches 10 credits or fewer, the service can charge the saved subscription payment method for a 100 SMS credit top-up. You can turn auto top-up off or on from the plugin dashboard.

= Can I manage billing inside WordPress? =

Yes. The dashboard includes subscription status, billing details, upgrades, cancellation controls, and auto top-up settings.

= What phone numbers are supported? =

The setup and account security validation currently expects UK mobile numbers starting with `07` or `+447`.

== Screenshots ==

1. Setup wizard for store verification and subscription selection.
2. SMS dashboard showing balance, plan, subscription, and recent messages.
3. SMS settings for WooCommerce order triggers, account security, and password reset messages.
4. Message logs with delivery status and credits used.

== Changelog ==

= 1.0.1 =
* Added WooCommerce compatibility declarations.
* Added subscription management, billing portal, upgrades, cancellation, and auto top-up controls.
* Added SMS logs, delivery status handling, and delivery-based credit deduction.
* Added customer account SMS two-factor authentication.
* Added optional SMS password reset messages.
* Added automatic shortlinks for supported URLs.
* Added UK mobile number validation and resend code controls.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.1 =
Adds subscription management, delivery-aware logs, customer account security features, and auto top-up controls.
