=== HisarPay Payment Buttons ===
Contributors: hisarpay
Tags: crypto, usdt, tron, payment button, qr code
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

Add USDT (TRC20) and TRX payment buttons, payment cards and QR codes to any page. No online store needed.

== Description ==

HisarPay Payment Buttons is the simplest way to get paid in crypto on a WordPress site: for a consulting call, a donation, a digital download or a deposit. Add the "HisarPay payment button" block or the `[hisarpay_button]` shortcode, and visitors who click it land on a secure HisarPay payment page with a QR code and the exact amount to send.

= Three looks =

* **Button**: a single call-to-action that fits in any paragraph.
* **Payment card**: the amount, the description and the accepted coins above the button.
* **QR code**: a code visitors scan with their phone to open the payment page, handy when they browse on a computer.

= Built for real sites =

* Fixed amounts create a fresh invoice for every click, on your server: your API key never reaches the browser.
* Or attach a payment link you prepared in the HisarPay dashboard, including links where the customer chooses the amount.
* Works without JavaScript, with page caching and with any theme; the styles follow your theme's text colour and stay readable in dark designs.
* Signed button parameters and a per-visitor rate limit stop anyone from changing the amount or flooding your account with invoices.
* Manage payment links (create, pause, resume, copy the shortcode) from Settings → HisarPay buttons.
* English and Turkish included.

= Shortcode attributes =

* `amount`: amount in USD, for example `49.90` (the minimum is 10 USD).
* `description`: shown on the card, the payment page and in your dashboard.
* `style`: `button` (default), `card` or `qr`.
* `label`: the button text. Default: "Pay with crypto".
* `token`: `usdt` or `trx`. Leave it out to let the customer choose.
* `link`: instead of `amount`, a payment link from your dashboard (`pl_…` or its ID).
* `success_url`: a thank-you page just for this button.

Example: `[hisarpay_button amount="49.90" description="Logo design" style="card"]`

The block has the same settings in its sidebar.

= External service =

This plugin uses the HisarPay API (https://hisarpay.com) to create invoices and payment links and to fetch the QR code images of your payment links. When a visitor presses a button, the amount, the description and the address of the page are sent to HisarPay; no visitor data is sent. Visitors are redirected to the HisarPay payment page to pay. See the HisarPay terms of use and privacy policy on hisarpay.com.

== Installation ==

1. Upload and activate the plugin (Plugins → Add New → Upload Plugin).
2. In the HisarPay dashboard, create an API key with the "invoices" permission under Developers → API keys. Start with a test key (hp_test_…).
3. Paste the key into Settings → HisarPay buttons and save. The screen confirms the connection.
4. Add the "HisarPay payment button" block to a page, or type a shortcode.

== Frequently Asked Questions ==

= Do I need WooCommerce? =

No. For a full store with a cart, use the HisarPay for WooCommerce plugin instead. These buttons are for sites without a store or for one-off payments.

= How does the QR style work with a fixed amount? =

A QR code has to point to an address that does not change, while an invoice can only be paid once. For `style="qr"` with an `amount`, the plugin therefore creates a fixed-price payment link in your HisarPay account the first time the button is shown, and reuses it afterwards. You will see it under Payment links.

= Where do I see payments? =

In the HisarPay dashboard under Invoices, and as Telegram notifications if you linked the HisarPay bot.

= My site is behind Cloudflare or another reverse proxy. Does the per-visitor limit still work? =

Each visitor can open at most 10 invoices every 5 minutes, counted per IP address. By default the plugin uses the address the connection comes from (REMOTE_ADDR), which visitors cannot forge. Behind a proxy that address is the proxy's, so all visitors share one limit. Return the real visitor IP from the `hisarpay_buttons_client_ip` filter, for example with Cloudflare (when your server only accepts traffic from Cloudflare):

`add_filter( 'hisarpay_buttons_client_ip', function ( $ip ) { return isset( $_SERVER['HTTP_CF_CONNECTING_IP'] ) ? $_SERVER['HTTP_CF_CONNECTING_IP'] : $ip; } );`

Values that are not a valid IP address are ignored.

= Is the API key stored safely? =

It is stored encrypted with your site's security keys (AUTH_KEY and AUTH_SALT in wp-config.php), never printed back into the settings page and only sent to the HisarPay API. If you change the security keys, enter the API key again.

== Changelog ==

= 1.1.0 =
* Payment links can be given an end and a number of uses; links that ended are not shown.
* New look: HisarPay's mark, the settings screen says in which mode it runs.
* Errors are explained in the language of the site.

= 1.0.0 =
* First release.
