=== WordPress Plugin — Jamesinvoicing ===
Contributors: jamesinvoicing
Tags: bitcoin, payments, woocommerce, cartflows, funnelkit, crypto, xpub, invoices
Requires at least: 5.8
Tested up to: 6.7
Requires PHP: 7.4
Stable tag: 2.0.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Pay in crypto, self-custodial cryptocurrency payment and invoicing platform designed for merchants.

== Description ==

The WordPress Plugin connects WordPress and WooCommerce to the Jamesinvoicing API. It creates a hosted invoice for the authoritative WooCommerce order total and keeps payment confirmation on the server. CartFlows, FunnelKit/WooFunnels, LaunchFlows and WPFunnels are supported when they create a standard WooCommerce order.

= Features =
* WooCommerce gateway: Pay with Bitcoin (Jamesinvoicing)
* CartFlows, FunnelKit/WooFunnels, LaunchFlows and WPFunnels order-context detection
* Coupons, taxes, shipping, fees, variations and order bumps use the final WooCommerce order total
* Universal order API with duplicate-invoice protection
* Signed Jamesinvoicing webhooks with timestamp and replay checks
* WooCommerce HPOS-compatible order reads and updates
* xPub Manager with verification and test address generation
* Unique receiving address per order — no address reuse
* Live USD/BTC exchange rate
* QR code, countdown timer, automatic confirmation polling
* Checkout shortcode [jamesinvoicing_checkout amount="100" item="Consulting"]
* Invoice shortcode [jamesinvoicing_invoice id="..."]
* Existing paycryptohost_* shortcodes remain supported for backwards compatibility
* Subscriptions support (WooCommerce Subscriptions)
* Integrations and System Status screens without exposing credentials
* Secure REST webhook with HMAC signature verification
* CSV export, PDF-ready invoice template
* Dark Mode + Light Mode, mobile responsive

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/` or install via the Plugins page.
2. Activate the plugin.
3. Go to Jamesinvoicing → Settings and add your API Key.
4. Go to Jamesinvoicing → xPub Manager and add and verify an xPub or supported receiving address.
5. (WooCommerce) Enable "Pay with Bitcoin (Jamesinvoicing)" under WooCommerce → Settings → Payments.

== Frequently Asked Questions ==

= Do you store private keys? =
No. Only the public xPub is stored. Private keys, seed phrases, and recovery phrases are never sent to or stored by the plugin.

= What about confirmations? =
Required confirmations are configurable in Settings. The plugin polls the Jamesinvoicing API every minute and also receives instant webhooks.

== Changelog ==

= 2.0.2 =
* Fixed repeat and retried WooCommerce orders so they reuse the existing invoice and always continue to its hosted Jamesinvoicing payment page.
* Updated the checkout payment description while preserving merchant-customized descriptions.

= 2.0.1 =
* Added support for the WooCommerce block-based Checkout page. Fixes "There are no payment methods available" on stores using the Checkout block.

= 2.0.0 =
* Added the universal Jamesinvoicing order API for WooCommerce and WooCommerce-based funnel checkouts.
* Added automatic context detection for CartFlows, FunnelKit/WooFunnels, LaunchFlows and WPFunnels.
* Uses the final WooCommerce order total, including variations, coupons, taxes, shipping, fees and order bumps.
* Added idempotent invoice creation so checkout retries cannot create duplicate invoices for one order.
* Added signed webhook delivery with timestamp checks, event replay protection and server-side status confirmation.
* Added Integrations and System Status screens, including API, webhook, cron, REST, HTTPS and HPOS checks.
* Added the jamesinvoicing_invoice shortcode while retaining existing shortcode names for backwards compatibility.
* Preserved existing settings, order metadata, API key format and installed-site upgrade paths.

= 1.7.0 =
* Fixed: payments already confirmed on the blockchain no longer stay on "Pending Payment" on the website, payment page, invoices or transactions.
* New PCH_Verify engine is the single source of truth: the invoice, transaction record, WooCommerce order and customer payment page all render the same verified status.
* Statuses are now verified against live blockchain data before anything is marked paid: real transaction, correct coin/network, invoice's own receiving address, amount received and required confirmations.
* Customer payment page shows "Payment Completed" with amount received, coin/network, transaction hash, confirmations, payment date and an explorer link; "Payment Confirming" while waiting for blocks.
* Underpaid protection kept and made explicit: short payments show "Underpaid", hold the order and are never completed. Wrong network, wrong address, invalid transactions and duplicate transactions are never completed either.
* Status updates run automatically from webhooks plus an authenticated poller that forces a fresh blockchain re-check, so the customer does not have to refresh.
* Webhook payloads are no longer trusted for status; every event triggers a live re-verification.
* Transactions and Invoices screens deduplicated: Invoices shows order/customer/amount, Transactions shows blockchain data only.
* If the blockchain/API is unavailable, nothing is marked as completed.

= 1.6.0 =
* Fixed confirmed payments remaining Pending when a store firewall blocks incoming webhooks.
* The built-in authenticated poller now always reconciles local invoice and WooCommerce order status.
* Webhooks accept both the current nested payload and older flat payloads.
* WooCommerce orders move to Processing on detection and Completed after final confirmation.

= 1.5.1 =
* Record the actual coin and network used for each payment on the linked WooCommerce order (meta + order note), instead of always showing Bitcoin.
* WooCommerce status transition now flows through payment_complete() so virtual/downloadable orders auto-complete and physical orders go to processing per the store's own WooCommerce setup.
* Webhook + pollers now forward coin, network, and amount_received from the platform.

= 1.4.6 =
* Gateway label renamed to "Pay with Jamesinvoicing.com" with the brand logo shown at checkout for stronger trust and recognition.
* Confirming animation now renders inline directly below the QR / address instead of overlaying them, so the QR and amount remain visible and copyable while the network confirms.

= 1.4.5 =
* Multi-coin checkout in WooCommerce: invoices now offer every coin the merchant has enabled + approved (BTC, USDT/TRC20, ETH, BCH, LTC, SOL, XMR, BNB).
* Live "Confirming…" animation on the invoice the moment a transaction is detected on-chain.
* Payment UI auto-locks (copy buttons, address, coin tabs) once a payment is detected or confirmed — prevents double-pay.
* Optional "Notify me by email" form on the invoice so customers can subscribe to the payment-confirmed email.
* Local invoice REST endpoint now proxies live payment_state + confirmations from Jamesinvoicing.


= 1.0.0 =
* Initial release.

== Changelog ==

= 1.5.1 =
* Wording: detection panel now reads "We're scanning for your payment" for clearer scanning/confirmation messaging.

= 1.4.8 =
* Wording: clear "Waiting for you to submit payment" state until a transaction is actually detected on-chain.
* Notify form hides on submit and replaced with a confirmation note.
* On detection the payment area (QR/address/amount/coin tabs) is hidden and replaced by "We're scanning for your payment".
* On confirmation we show the invoice number, what was paid for and a "Download PDF receipt" button.

= 1.4.0 =
* API-Key only setup: Merchant ID and Secret Key are no longer required.
* Switched to Authorization: Bearer authentication on every API call.
* Endpoints now target /api/public/v1/ (merchant/ping, merchant/generate-address, merchant/invoice-status).
* Live connection badge on the Settings page reports Connected / Invalid API key / Wallet not ready.
* Invoice creation goes through the canonical platform endpoint so the wallet, address derivation and rate are always consistent with jamesinvoicing.com.
* WooCommerce 9.x + HPOS compatible. Tested with WordPress 6.7 and PHP 8.3.

== Changelog ==

= 1.4.5 =
* Multi-coin invoice: customers can now pay with any coin the merchant has enabled and approved (BTC, USDT/TRC20, ETH, BCH, LTC, SOL, XMR, BNB). Coin picker with logo/symbol tabs renders automatically when more than one coin is available.
* Invoice template simplified: shows only Invoice #, "Paying for" (product name), Amount (USD), the selected coin's exact amount, and the receiving address. Removed rate/customer/date noise.
* Copy buttons for BOTH the exact crypto amount AND the receiving address.
* "Send exact amount, single transaction, correct network" warning added inside every invoice.
* WooCommerce thank-you page: order details and billing table can be hidden via the new "Hide order details on thank-you page" gateway setting, leaving only the invoice block + product name + pay link.
* QR codes now use the correct URI scheme per coin (bitcoin:, litecoin:, bitcoincash:, ethereum:, monero:).
