=== HisarPay for WooCommerce ===
Contributors: hisarpay
Tags: crypto, usdt, tron, trc20, payments
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Take USDT (TRC20) and TRX payments in your WooCommerce store. Orders update on their own when the payment lands on the TRON network.

== Description ==

HisarPay for WooCommerce adds a crypto payment method to your checkout. When a customer chooses it, the plugin creates a HisarPay invoice for the order total and sends the customer to a secure payment page with a QR code, the exact amount and a live confirmation counter. Once the payment is confirmed on chain, the order moves to Processing and your usual WooCommerce emails go out.

= What you get =

* USDT on TRC20 and TRX, priced in USD at the moment of checkout.
* Works with the block-based Cart and Checkout and with the classic shortcode checkout.
* Compatible with High-Performance Order Storage (HPOS).
* Signed webhooks for instant order updates, plus a background check every 10 minutes and a check when the customer returns to your store, so no payment is missed.
* Clear order notes for every case: partial payments, overpayments, payments within your underpayment tolerance and late payments.
* Test mode: with a test API key you can mark invoices as paid, partially paid or expired from the payment page.
* Settings for accepted coins, invoice lifetime (5–1440 minutes), who pays the HisarPay commission and a conversion rate for stores that do not sell in USD.
* A box on the order screen with the state, the amounts and the transactions, and a check with one click.
* A connection test for the API key and the webhook set-up, and a debug log that never contains your keys.
* English and Turkish included.

= How orders follow the invoice =

* Paid or overpaid: the order becomes Processing (or Completed for virtual downloadable products).
* Partially paid: the order goes On hold until the customer sends the rest.
* Expired or cancelled without any payment: the order is cancelled, but only while it is still waiting for payment.
* A payment that arrives after the invoice expired is still credited to you and reopens a cancelled order, with a note asking you to check stock.

= Before you start =

You need a HisarPay merchant account. Use a test key (hp_test_…) while your account is under review, then switch to a live key (hp_live_…).

HisarPay prices invoices in US dollars. If your store uses another currency, enter an exchange rate in the settings; the payment method stays hidden until you do. The plugin never guesses an exchange rate.

= External service =

This plugin connects to the HisarPay API (https://hisarpay.com) to create and read invoices for your orders. It sends the order total, the order number, your store name, the return addresses of your store and an internal reference; it does not send your customer's name or address. The customer's e-mail address is sent only if you switch on receipts in the settings. Customers are redirected to the HisarPay payment page to pay. See the HisarPay terms of use and privacy policy on hisarpay.com.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/` or install the zip from Plugins → Add New → Upload Plugin, then activate it.
2. In the HisarPay dashboard, open Developers → API keys and create a key with the "invoices" permission.
3. In Developers → Webhooks, add an endpoint with the URL shown in the plugin settings (`https://your-store.example/wp-json/hisarpay/v1/webhook`), select the invoice events and copy its signing secret (whsec_…).
4. In WooCommerce → Settings → Payments → HisarPay, paste the key and the signing secret, press "Test connection", enable the method and save.

== Frequently Asked Questions ==

= Do I need to keep a wallet open? =

No. Payments are received by HisarPay and credited to your HisarPay balance, from where you withdraw to your own wallet.

= What happens if the customer sends too little? =

The order goes On hold and the customer can send the remaining amount to the same address until the invoice expires. Small differences inside the underpayment tolerance you set in HisarPay are accepted automatically and noted on the order.

= What if my site cannot receive webhooks? =

Orders are still updated by the background check every 10 minutes (WooCommerce's Action Scheduler) and whenever the customer returns to the order confirmation page. You can also run "Check HisarPay payment status" from the order actions.

= Does the plugin support refunds? =

A refund is sent from the invoice in your HisarPay dashboard (the order screen links to it), to an address the customer gives you. The plugin does not issue refunds automatically: the address a payment came from is often an exchange's and must not be paid back to blindly.

= Is my API key safe? =

The API key and the webhook signing secret are stored encrypted with your site's security keys (AUTH_KEY and AUTH_SALT in wp-config.php), are never printed back into the settings page, are only sent to the HisarPay API over HTTPS and are removed from every log line. If you change the security keys, enter the credentials again.

== Changelog ==

= 1.1.0 =
* The order screen has a HisarPay box: state, amounts, transactions, a check and the way to the invoice.
* The settings screen shows what is ready and what is missing.
* Optional receipts: the customer gets one from HisarPay once the payment is final.
* New brand mark.

= 1.0.0 =
* First release.
