=== TxRoutePay for WooCommerce ===
Contributors: txroutepay
Tags: usdt, crypto, payment gateway, tron, bep20
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Accept USDT on TRON (TRC20) and BNB Smart Chain (BEP20) with TxRoutePay, a non-custodial crypto payment gateway.

== Description ==

TxRoutePay lets your customers pay WooCommerce orders in USDT. Payments go straight to your own wallets: TxRoutePay never holds your funds.

* USDT on TRON (TRC20) and BNB Smart Chain (BEP20); customers pick the network when both are enabled.
* Works with the classic checkout and the Cart & Checkout blocks.
* Compatible with High-Performance Order Storage (HPOS).
* Secure, signed webhooks (HMAC-SHA256 with timestamp check) mark orders paid automatically. Amounts are always re-checked against the TxRoutePay API.
* Handles paid, overpaid, late, underpaid (on-hold) and expired invoices, with clear order notes and block-explorer links.
* Test mode is detected automatically from a `pk_test_` key (TRON Nile / BSC testnet).

Amounts are charged 1:1 in USDT, so the store currency must be US Dollar (USD). Developers can use the `txroutepay_order_amount` and `txroutepay_supported_currencies` filters to add their own conversion.

== Installation ==

1. Upload the `txroutepay-for-woocommerce` folder to `/wp-content/plugins/` or install the zip via Plugins → Add New → Upload Plugin, then activate it.
2. Go to WooCommerce → Settings → Payments → TxRoutePay (USDT).
3. Paste your API key (`pk_live_…` for real payments or `pk_test_…` for testnets).
4. Copy the **Webhook URL** shown on the settings page. In the TxRoutePay dashboard open Developers → Webhooks, add that URL, and paste the signing secret (`whsec_…`) into the plugin settings.
5. Choose the networks you want to offer, enable the gateway and save.

== Frequently Asked Questions ==

= Which currency must my store use? =

US Dollar. The order total is sent as a USDT amount with 2 decimals. With any other currency the gateway is hidden and an admin notice explains why.

= How do I test? =

Use a `pk_test_` API key. Invoices are then created on TRON Nile and BSC testnet and the checkout shows a "TEST MODE" hint.

= What happens if the customer pays too little or too late? =

Underpaid invoices put the order on hold with a note. Expired invoices cancel orders that are still pending; if a late payment then arrives, the order is still marked paid.

= Will orders update if webhooks are not configured? =

The order-received page re-checks the invoice when the customer returns, but webhooks are the reliable way. Configure them before going live.

= Developer hooks =

* `txroutepay_api_base` – API base URL (default `https://txroutepay.com/v1`, or define `TXROUTEPAY_API_BASE`).
* `txroutepay_order_amount` – USDT amount string for an order.
* `txroutepay_supported_currencies` – store currencies the gateway is offered for (default USD, USDT).
* `txroutepay_external_order_id` – external order id (default `wc-{order_id}-{network}-{attempt}`).
* `txroutepay_invoice_request` – full invoice request body.
* `txroutepay_dashboard_url` – merchant dashboard link for an invoice.

== External services ==

This plugin connects to the TxRoutePay API (https://txroutepay.com/v1) to create payment invoices and to check their status.

* When a customer places an order with this payment method, the plugin sends the order amount, the chosen network, the order id and number, the site name, the order-received URL and the billing email address.
* When a webhook arrives or the customer views the order-received page, the plugin requests the invoice status.

The customer is then redirected to the TxRoutePay hosted payment page. Service provided by TxRoutePay: Terms of Service https://txroutepay.com/terms, Privacy Policy https://txroutepay.com/privacy.

== Changelog ==

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
