=== MercanPay – Crypto Payment & Donation Buttons ===
Contributors: mercanpay
Tags: crypto, donation, usdt, tron, payment button
Requires at least: 6.0
Tested up to: 6.8
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 TRX and USDT (TRC20) payments and donations on any WordPress site with a button, card or QR code. No WooCommerce needed.

== Description ==

**English**

MercanPay is a crypto payment gateway for TRX and USDT-TRC20. In your MercanPay panel you create *payment links* – a fixed price (an e-book, a consultation, a ticket) or an open amount (donations, "pay what you want", tips). This plugin puts those links on your blog, news site, nonprofit or creator page:

* **Button** – a polished "Pay with crypto" / "Donate" button in the MercanPay gradient, with TRX and USDT icons.
* **Card** – the link's title, description and price (or "any amount" with the min/max range), a button and an optional small QR code.
* **QR code** – a scannable QR with a caption and a fallback link, ideal for sidebars and printed material.

Add it with the **"MercanPay payment button" block** (live preview in the editor, dropdown of your links when an API key is set) or the **[mercanpay] shortcode**. Your visitors pay on MercanPay's hosted payment page; no wallet, account or extension is needed on your site.

* No WooCommerce, no build step, no tracking.
* The stylesheet loads only on pages that use a button.
* The optional API key stays on your server – it is never sent to visitors.
* English and Turkish included.

**Türkçe**

MercanPay, TRX ve USDT-TRC20 için bir kripto ödeme altyapısıdır. MercanPay panelinizde *ödeme linkleri* oluşturursunuz: sabit fiyatlı (e-kitap, danışmanlık, bilet) ya da serbest tutarlı (bağış, "istediğin kadar öde", bahşiş). Bu eklenti o linkleri blogunuza, haber sitenize, derneğinizin ya da içerik üreticisi sayfanıza ekler:

* **Buton** – MercanPay renk geçişli, TRX ve USDT simgeli şık bir "Kripto ile öde" / "Bağış yap" butonu.
* **Kart** – linkin başlığı, açıklaması ve fiyatı (ya da en az / en fazla aralığıyla "serbest tutar"), bir buton ve isteğe bağlı küçük bir QR kod.
* **QR kod** – açıklama metni ve yedek linkiyle okutulabilir QR; kenar çubukları ve basılı materyal için ideal.

**"MercanPay ödeme butonu" bloğu** (editörde canlı önizleme, API anahtarı girildiyse linklerinizden seçim) ya da **[mercanpay] kısa kodu** ile ekleyin. Ziyaretçileriniz MercanPay'in ödeme sayfasında öder; sitenizde cüzdan, hesap ya da eklenti gerekmez.

* WooCommerce gerekmez, derleme adımı yok, izleme yok.
* Stil dosyası yalnızca buton kullanılan sayfalarda yüklenir.
* İsteğe bağlı API anahtarı sunucunuzda kalır, ziyaretçilere asla gönderilmez.
* Türkçe ve İngilizce dil desteği.

= Shortcode / Kısa kod =

`[mercanpay link="pl_XXXXXXXXXX"]`

`[mercanpay link="https://mercanpay.com/l/pl_XXXXXXXXXX" style="card" qr="yes" align="center"]`

`[mercanpay link="pl_XXXXXXXXXX" style="qr" text="Scan to support us"]`

Attributes:

* `link` – the payment link address (`https://mercanpay.com/l/pl_…`) or its code (`pl_…`). Required.
* `style` – `button`, `card` or `qr` (default from the settings).
* `text` – button text (for `qr`: the caption).
* `align` – `left`, `center` or `right`.
* `new_tab` – `yes` or `no` (default from the settings).
* `amount` – for open-amount links: a USD amount such as `25`. The button then skips the link page and opens the payment page for that amount.
* `lang` – `tr` or `en`: language of the payment page (default: the visitor's browser).
* `title`, `description`, `price` – what the card shows when no API key is set (or to override MercanPay's values).
* `qr` – `yes` to show a small QR code on the card.
* `class` – extra CSS classes.

= Privacy / Gizlilik =

The plugin itself stores no visitor data. Pressing a button takes the visitor to mercanpay.com. The QR styles load the QR image from mercanpay.com, so the visitor's browser contacts mercanpay.com when the page is shown. With an API key, your server calls the MercanPay API (at most once every 10 minutes) to read your payment links.

Eklenti ziyaretçi verisi saklamaz. Butona basan ziyaretçi mercanpay.com'a gider. QR görünümleri QR resmini mercanpay.com'dan yükler. API anahtarı girildiyse sunucunuz ödeme linklerinizi okumak için MercanPay API'sini (en fazla 10 dakikada bir) çağırır.

== Installation ==

1. Upload the plugin (Plugins → Add New → Upload Plugin → `mercanpay-buttons-1.0.0.zip`) and activate it.
2. In your MercanPay panel, open **Payment links** and create a link. Copy its address (`https://mercanpay.com/l/pl_…`).
3. Edit a post or page, add the **MercanPay payment button** block and paste the address – or type `[mercanpay link="pl_…"]`.
4. Optional: in **Settings → MercanPay Buttons**, add a live API key with the `invoices` scope. Cards then show the link's title, description and price automatically, and the block lists your links in a dropdown. Press **Test connection** to check it.

**Kurulum**

1. Eklentiyi yükleyin (Eklentiler → Yeni ekle → Eklenti yükle → `mercanpay-buttons-1.0.0.zip`) ve etkinleştirin.
2. MercanPay panelinizde **Ödeme linkleri** bölümünden bir link oluşturun ve adresini (`https://mercanpay.com/l/pl_…`) kopyalayın.
3. Bir yazı ya da sayfaya **MercanPay ödeme butonu** bloğunu ekleyip adresi yapıştırın – ya da `[mercanpay link="pl_…"]` yazın.
4. İsteğe bağlı: **Ayarlar → MercanPay Butonları** sayfasına `invoices` yetkili canlı bir API anahtarı girin. Kartlar linkin başlığını, açıklamasını ve fiyatını otomatik gösterir, blok linklerinizi listeler. **Bağlantıyı test et** ile kontrol edin.

== Frequently Asked Questions ==

= Do I need WooCommerce? / WooCommerce gerekli mi? =

No. This plugin works on any WordPress site. (For WooCommerce stores there is a separate "MercanPay for WooCommerce" gateway.)
Hayır. Eklenti her WordPress sitesinde çalışır.

= Do I need an API key? / API anahtarı gerekli mi? =

No. Buttons and QR codes work with just the link. The key only lets the card show your link's title and price automatically and lets the block list your links. Without a key, type the title, description and price into the block (or the shortcode's `title`, `description`, `price`).
Hayır. Buton ve QR kod yalnızca linkle çalışır. Anahtar, kartın başlık ve fiyatı otomatik göstermesi ve bloğun linklerinizi listelemesi içindir.

= Is my API key safe? / API anahtarım güvende mi? =

It is stored in your WordPress database, used only by your server to call the configured MercanPay address, and never printed into a page (the settings field stays empty and shows only a masked version). Use a key with only the `invoices` scope. Test keys (`mp_test_…`) cannot list payment links.

= Can I pre-fill the amount of a donation link? / Bağış tutarını önceden doldurabilir miyim? =

Yes: `amount="25"` (or the block's *Advanced → Amount* field). The button then sends the amount straight to MercanPay, which opens the payment page for $25. If the amount is outside the link's range, the visitor sees the link page with the amount filled in and a message. For fixed-price links the amount is ignored.

= Which coins are supported? / Hangi coinler destekleniyor? =

TRX and USDT on the TRON network (TRC20), as configured on the payment link. The amount is set in USD and converted at the current rate.

= The button shows nothing. / Buton görünmüyor. =

Visitors see nothing when the link is missing or invalid; logged-in editors see a short explanation in its place. Only links on mercanpay.com are accepted.

= Can I test against my own MercanPay server? =

Yes: `define( 'MERCANPAY_BUTTONS_HOST', 'https://pay.example.com' );` in `wp-config.php` (or the `mercanpay_buttons_host` filter). Only https origins are accepted (http only for localhost).

== Screenshots ==

1. Button style – "Pay with crypto" with TRX and USDT icons, in the MercanPay gradient.
2. Card style – title, description, price or "any amount" range, button and a small QR code.
3. QR style – a scannable QR code with a caption and a fallback link.
4. The "MercanPay payment button" block with its settings and live preview in the editor.
5. Settings → MercanPay Buttons: optional API key, defaults and "Test connection".

== Changelog ==

= 1.0.0 =
* First release: [mercanpay] shortcode and "MercanPay payment button" block with button, card and QR styles; optional API key for link details and the block's link list (cached for 10 minutes); amount pre-fill for open-amount links; settings page with connection test; English and Turkish.

== Upgrade Notice ==

= 1.0.0 =
First release.
