=== CXPay for WooCommerce ===
Contributors: cxpay
Tags: cryptocurrency, payments, woocommerce, non-custodial, bitcoin, ethereum
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
Stable tag: 0.3.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Accept crypto payments via cxpay.cash with non-custodial settlement to your own wallet.

== Description ==

CXPay is a generic merchant payment gateway. Payers pay your wallet directly; CXPay never holds funds.

1. Sign up at https://cxpay.cash/signup
2. Add a payout wallet and create an API key
3. Install this plugin and paste your API key (webhook secret is auto-registered when possible)
4. Take payments on classic and Blocks checkout

Fees (accrued / invoiced out of band): 1% standard, 0.5% CXCASH, $0.30 minimum.

== Installation ==

1. Upload the `cxpay-for-woocommerce` folder to `/wp-content/plugins/`, or install the zip via Plugins → Add New → Upload Plugin
2. Activate the plugin
3. WooCommerce → Settings → Payments → CXPay: paste your `cxpay_test_` or `cxpay_live_` API key
4. Click **Test connection**, then Save. The plugin registers its webhook and stores the signing secret when the secret field is empty
5. Ensure a payout wallet is configured in the CX Pay dashboard

Advanced: override API base URL (default `https://cxpay.cash/api/v1`) if you use staging.

== Frequently Asked Questions ==

= Is a webhook secret required? =

Yes. The gateway is not available without a signing secret. Unsigned webhooks are rejected with HTTP 401.

= Does it support WooCommerce Blocks? =

Yes. Classic checkout and Cart/Checkout Blocks are supported. High-Performance Order Storage (HPOS) is declared compatible.

= What if a webhook is missed? =

A WP-Cron / Action Scheduler job polls pending CX Pay orders. The order-received page also refreshes status.

= Test mode? =

Use a `cxpay_test_` API key only when the CX Pay server has a sandbox engine configured
(`sandboxAvailable` from Test connection / GET /me). If test mode is unavailable on the server,
CX Pay is live-only — use a `cxpay_live_` key and verify with a small real payment. TEST keys never
create mainnet charges; the API returns error code `sandbox_unavailable` instead.

== Changelog ==

= 0.3.3 =
* Send customerEmail, orderNumber, and webhookUrl on payment-link create

= 0.3.1 =
* Fix fatal webhook lookup: use ctype_digit (not undefined ctype_get_order)
* Harden sanitising/escaping and i18n for admin AJAX + webhook responses
* Domain Path header; exclude tests from distributable zip

= 0.3.0 =
* Paste API key only; default API base https://cxpay.cash/api/v1
* Test connection (AJAX) via GET /me
* Auto-register webhook endpoint + store secret; manual secret fallback
* Store currency + amountMinor with return/cancel URLs and idempotency
* Full status mapping, event-id idempotency, amount binding checks
* Status poll fallback (cron + thank-you page)
* Blocks checkout + HPOS compatibility
* Distributable zip build script

= 0.2.0 =
* Require webhook signing secret (fail closed)
* Send Idempotency-Key and WooCommerce order metadata
* Declare High-Performance Order Storage compatibility

= 0.1.0 =
* Initial gateway release

== Upgrade Notice ==

= 0.3.1 =
Fixes a fatal error in webhook order lookup. Update recommended.

= 0.3.0 =
Self-serve install: paste API key, test connection, auto webhook registration.
