﻿=== Payments Square Connect ===
Contributors: wppayments
Tags: woocommerce, square, payments, checkout, contact form 7
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.6
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

WooCommerce and Contact Form 7 payments via Square Hosted Checkout, OAuth, and webhooks.

== Description ==

This plugin redirects customers to Square Hosted Checkout. Connect Square once under **Settings → Payments Square Connect**; WooCommerce checkout and Contact Form 7 forms share the same connection.

When you enable Payments Square Connect, the site exchanges data with **Square** for payments, OAuth, and webhooks.

**WooCommerce:** enable the gateway under WooCommerce → Settings → Payments and customize the checkout title and description.

**Contact Form 7:** add the `[square_pay]` form tag to accept fixed or field-based amounts. Example: `[square_pay amount:25.00]` or `[square_pay amount-field:your-amount]` with a matching number field.

== External services ==

This plugin is a client for third-party services. By using it you direct WordPress to contact those services.

* **Square (required for payments and connection)**  
  * **What:** OAuth, REST API calls (e.g. locations, payment links), and hosted checkout pages.  
  * **When:** When a store admin uses "Connect with Square", when checkout or a Contact Form 7 payment creates a payment link, and when Square sends webhooks to your site.  
  * **Endpoints (summary):** `https://connect.squareup.com` or `https://connect.squareupsandbox.com` (OAuth and API), plus Square's hosted checkout URLs returned in API responses.  
  * **Data sent:** API requests include OAuth tokens after connection, order or form-derived totals and references needed to create checkout, and webhook payloads as defined by Square.  
  * **Terms:** https://squareup.com/legal - review Square's developer and seller terms for your region.

* **WPPayments OAuth relay (required for Connect with Square)**  
  * **What:** Registers your site and completes Square OAuth so application secrets are not stored in WordPress.  
  * **When:** When a store admin clicks **Connect with Square**.  
  * **Endpoint:** `https://shc4wc-square-oauth.wordpress-ingenious.workers.dev`  
  * **Data sent:** Your site URL, sandbox/live environment, and signed session identifiers needed to finish OAuth.  
  * **Terms:** https://squareup.com/legal (Square OAuth); contact the plugin author for questions about the relay service.

Store admins explicitly start OAuth by clicking **Connect with Square**; customers are sent to Square's hosted pages only during checkout or after submitting a Contact Form 7 payment form.

== Privacy ==

* **Site owners:** OAuth and API usage are initiated by an administrator with `manage_options`. Tokens are stored in the WordPress database (options) like other payment settings.  
* **Customers:** Personal and payment data on hosted checkout is processed by **Square** under Square's policies, not by form fields added by this plugin on your site for card entry.  
* **Logging:** Optional WooCommerce logs may record technical details when debug logging is enabled; disable debug in normal production.  
* For compliance questions, consult Square's documentation and your legal advisor; this readme is not legal advice.

== Installation ==

1. Activate the plugin (WooCommerce is required; Contact Form 7 is optional).
2. Go to **Settings → Payments Square Connect**.
3. Choose environment (Sandbox/Live).
4. Connect your Square account and select a location.
5. Save settings.
6. For WooCommerce: go to **WooCommerce → Settings → Payments → Payments Square Connect**, enable the gateway, and set the checkout title and description.
7. For Contact Form 7: add `[square_pay]` to a form (see Description above).

== Changelog ==

= 1.0.6 =
* Ship default OAuth relay URL so Connect with Square works on fresh installs without manual Worker configuration.
* Simplified connection settings (merchant Connect UI only).

= 1.0.5 =
* Shared Square connection hub under Settings → Payments Square Connect (one Connect for WooCommerce and Contact Form 7).
* WooCommerce gateway settings limited to checkout display options; connection moved to the shared settings page.
* Contact Form 7 support via `[square_pay]` form tag (fixed or field-based amounts).
* Generic Square payment link API used by both WooCommerce orders and CF7 submissions.

= 1.0.4 =
* Freemius SDK integrated for licensing, updates, and analytics.
* Prevent duplicate plugin bootstrap when multiple copies are present.
* Show a short test-mode notice at checkout when environment is Sandbox.

= 1.0.3 =
* Plugin display name adjusted for WordPress.org naming checks (removed restricted wording).
* Main bootstrap file and folder slug aligned with `payments-connect-square` for Plugin Check text-domain validation.

= 1.0.2 =
* Plugin display name updated for trademark guidelines.
* Text domain aligned with plugin slug `payments-connect-square`.

= 1.0.0 =
* Initial release.
