=== Bezanbecard for WooCommerce ===
Contributors: bezanbecard
Tags: card to card, bank transfer, receipt, iran, کارت به کارت
Requires at least: 6.5
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

Offline payments with receipt (card-to-card or bank transfer): the customer uploads the bank receipt and your team approves it.

== Description ==

= فارسی =

**بزن به کارت** نرم‌افزار تطبیق و سند پرداخت‌های آفلاین است. مشتری مبلغ سفارش را از اپلیکیشن بانکی خودش، به‌صورت کارت به کارت یا انتقال بانکی (پل، پایا، ساتنا)، مستقیم به کارت یا حساب شما می‌پردازد و رسید بانکی را در صفحه پرداخت می‌فرستد. تیم شما رسید را در داشبورد بزن به کارت بررسی می‌کند و با تأیید آن، سفارش پرداخت‌شده ثبت می‌شود. هر مرحله به‌عنوان سند پرداخت ثبت می‌شود. پول هیچ‌وقت از دست ما عبور نمی‌کند.

* **رسید و بررسی:** وقتی مشتری رسید می‌فرستد، سفارش «در انتظار بررسی» می‌ماند و یادداشت «رسید ارسال شد، در انتظار بررسی» می‌گیرد. اگر رسید رد شود و مبلغی نرسیده باشد، سفارش دوباره «در انتظار پرداخت» می‌شود.
* **مبلغ یکتا برای هر سفارش:** با مبلغ یکتا (که به‌طور پیش‌فرض روشن است) هر پرداخت مبلغ دقیق و منحصربه‌فردی دارد تا هر واریز دقیقاً به یک سفارش وصل شود.
* **واریز ناقص بن‌بست نیست:** اگر مشتری کمتر واریز کند، سفارش «در انتظار بررسی» می‌ماند، مبلغ دریافت‌شده و باقی‌مانده در یادداشت سفارش ثبت می‌شود و صفحه پرداخت مبلغ باقی‌مانده را از مشتری می‌خواهد.
* **اضافه‌پرداخت و بررسی دستی:** اضافه‌پرداخت‌ها و واریزهایی که نیاز به بررسی دارند در یادداشت سفارش و داشبورد بزن به کارت نمایش داده می‌شوند.
* **اتصال با یک کلیک:** دکمه «اتصال به بزن به کارت» کلید API و وب‌هوک را خودکار تنظیم می‌کند؛ تنظیم دستی کلیدها هم ممکن است.
* **حالت آزمایشی و واقعی:** در حالت آزمایشی با واریزهای شبیه‌سازی‌شده همه چیز را بدون جابه‌جایی پول امتحان کنید.
* **وب‌هوک امضاشده:** هر رویداد با HMAC-SHA256 امضا می‌شود و افزونه پیش از هر تغییری، وضعیت پرداخت را دوباره از API می‌پرسد.
* **سازگار با ووکامرس جدید:** پشتیبانی از صفحه پرداخت بلوکی، ذخیره‌سازی سفارش با کارایی بالا (HPOS) و واحدهای ریال، تومان، هزار ریال و هزار تومان.
* **کادر پرداخت در صفحه سفارش:** وضعیت، مبلغ دریافت‌شده و باقی‌مانده، فهرست واریزها، پیوند صفحه پرداخت برای ارسال به مشتری و دکمه به‌روزرسانی.

= English =

**Bezanbecard** is reconciliation and evidence software for offline payments. The customer pays the order amount from their own banking app, card-to-card or by bank transfer (Pol, Paya, Satna), straight to your card or account, and uploads the bank receipt on the payment page. Your team reviews the receipt in the Bezanbecard dashboard, and approving it marks the order paid. Every step is kept as evidence. Bezanbecard never holds your money.

* **Receipts and review:** when the customer sends a receipt, the order goes on hold with the note "Receipt submitted, waiting for review". If the receipt is rejected and nothing was received, the order is pending payment again.
* **A unique amount per order:** with unique amounts on (the default), every payment asks for an exact, unique amount, so each transfer matches exactly one order.
* **A short transfer is not a dead end:** when a customer transfers less than the total, the order goes on hold, the order note records what was received and what remains, and the payment page asks the customer for the rest.
* **Overpayments and reviews:** overpayments and transfers that need a human are written to the order notes and shown in your Bezanbecard dashboard.
* **One-click connect:** "Connect with Bezanbecard" sets up the API key and the webhook for you. Manual key entry is available too.
* **Test and live modes:** try every flow with simulated deposits before any real money moves.
* **Signed webhooks:** every event is signed with HMAC-SHA256, and the plugin reads the payment back from the API before it changes an order.
* **Modern WooCommerce:** checkout block support, High-Performance Order Storage (HPOS), and stores priced in rial, toman, thousand rial or thousand toman.
* **Payment box on the order screen:** status, amount received and remaining, deposits, the payment page link to send the customer, and a refresh button.

= Requirements =

* A Bezanbecard account (https://bezanbecard.com) with your card or bank account added as a destination. The Bezanbecard SMS watcher app is optional: it only corroborates receipts from your bank SMS.
* WooCommerce 8.2 or later, with the store currency set to Iranian rial (IRR), toman (IRT), thousand rial (IRHR) or thousand toman (IRHT).
* Order totals between 10,000 and 2,000,000,000 rial.

== External services ==

This plugin connects to the Bezanbecard service, which you need an account with to accept payments.

* **Bezanbecard API (https://a.bezanbecard.com):** when a customer places an order with this payment method, the plugin sends the order amount in rial, the order number, a description containing the store name, the customer's name, mobile number and email (when they are valid), the return and cancel URLs, and the order id, order key and site address as metadata. It reads the payment back when the customer returns, when a webhook arrives and when you press "Refresh from Bezanbecard". "Connect with Bezanbecard" exchanges a one-time code for your keys.
* **Bezanbecard dashboard (https://bezanbecard.com):** the customer is sent to the hosted payment page there, and "Connect with Bezanbecard" opens the dashboard with your site address, site name, return URL and webhook URL.
* Bezanbecard sends signed webhooks to `/wp-json/bezanbecard/v1/webhook` on your site.

Terms of service: https://bezanbecard.com/legal/terms
Privacy policy: https://bezanbecard.com/legal/privacy

== Installation ==

1. Install and activate WooCommerce, then install and activate **Bezanbecard for WooCommerce**.
2. Go to **WooCommerce → Settings → Payments → Bezanbecard**.
3. Press **Connect with Bezanbecard**, sign in to your Bezanbecard dashboard, choose test or live mode and approve the store. The key and the webhook are set up for you.
4. Or set them up by hand: in the Bezanbecard dashboard open **Developers**, create a secret key and a webhook endpoint pointing to the URL shown in the settings, subscribe it to the payment events, and paste the key (`sk_test_…` / `sk_live_…`) and the signing secret (`whsec_…`) into the settings.
5. Choose the order status after payment, whether to accept partial transfers and the payment window, then enable the payment method.
6. Place a test order in test mode, upload a receipt on the payment page and approve it in your Bezanbecard dashboard (or simulate the deposit) before switching to live.

== Frequently Asked Questions ==

= Does Bezanbecard hold my money? =

No. The customer pays straight to your own card or account. Bezanbecard keeps the receipt and the evidence and ties the payment to the order.

= What happens when a customer pays the wrong amount? =

A smaller payment is recorded as a partial payment: the order goes on hold with a note showing what was received and what remains, and the customer can pay the rest on the same payment page. A larger payment completes the order and the overpayment is noted so you can refund, credit or keep it from the Bezanbecard dashboard.

= My orders stay pending after the customer paid. =

Check that the webhook signing secret for the current mode is saved, and that your security plugin or firewall does not block the WordPress REST API route `/wp-json/bezanbecard/v1/webhook`. You can always press **Refresh from Bezanbecard** in the order's Bezanbecard payment box, and the WooCommerce logs (source `bezanbecard`) show every failed call.

= Which currencies are supported? =

Iranian rial (IRR) and toman (IRT) from WooCommerce, plus thousand rial (IRHR) and thousand toman (IRHT) from the Persian WooCommerce plugin. Amounts are converted to rial exactly, without floating-point rounding.

= Does it work with the checkout block and HPOS? =

Yes. The plugin declares compatibility with High-Performance Order Storage and registers itself with the WooCommerce checkout block.

== Changelog ==

= 1.0.0 =
* First release: offline payments with receipt (card-to-card or bank transfer) through Bezanbecard, orders on hold while a receipt waits for review, partial payments with top-up, overpayment and review notes, signed webhooks, signed return verification, one-click connect, order payment box, checkout block, HPOS, Persian translation.

== Upgrade Notice ==

= 1.0.0 =
First release.
