=== DreamPay for WooCommerce ===
Contributors: dreamlance
Tags: bkash, nagad, rocket, payment gateway, bangladesh
Requires at least: 5.8
Tested up to: 6.9
Requires PHP: 7.4
WC requires at least: 6.0
WC tested up to: 10.9
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Accept bKash, Nagad, Rocket and Upay (BDT) plus international Card / PayPal / Crypto (USD) through your own self-hosted DreamPay server.

== Description ==

DreamPay is a self-hosted payment automation server. Customers pay straight to your own bKash / Nagad / Rocket / Upay number, an Android phone forwards the payment SMS to your DreamPay server, and the order is confirmed automatically. No payment aggregator, no settlement delay.

This plugin connects WooCommerce to your DreamPay server (any UddoktaPay-compatible server also works).

**Two payment methods**

* **bKash / Nagad / Rocket / Upay** — charged in BDT via `/api/checkout-v2`.
* **International — Card / PayPal / Crypto** — charged in USD via `/api/checkout-v2/global`.

**Features**

* Works with both the classic checkout and the Cart & Checkout blocks.
* HPOS (High-Performance Order Storage) compatible.
* Every payment is verified server-to-server with `verify-payment` — on the customer's return, on the webhook (IPN) and on a manual "Re-check payment" from the order screen. Webhook bodies are never trusted.
* Webhook protection with your API key and an optional HMAC signature secret (`X-DreamPay-Signature`).
* Idempotent: an order is never completed twice, even if the return and the webhook arrive at the same moment.
* Amount and currency checks — underpaid orders are put on hold for review.
* Exchange rate setting when your store currency is not BDT (local) or USD (international).
* Refunds from the WooCommerce order screen are recorded on DreamPay. MFS (bKash/Nagad/…) refunds must be sent manually; the order note tells you the customer's number.
* "Test connection" button that shows your DreamPay brand and active payment methods.
* "Pay now" button on the customer's order page for unpaid orders.
* Bangla-friendly default texts.
* Debug log via WooCommerce > Status > Logs (source `dreampay`).

== Installation ==

1. Upload the `dreampay-for-woocommerce` folder to `/wp-content/plugins/` or install the zip from Plugins > Add New > Upload.
2. Activate the plugin (WooCommerce must be active).
3. Go to WooCommerce > Settings > Payments > **DreamPay — bKash / Nagad / Rocket / Upay**.
4. Enter your DreamPay **API base URL** (e.g. `https://pay.example.com`) and **API key**, click **Test connection**, enable and save.
5. Optional: enable **DreamPay — International**. Its URL / key / secret fields can be left empty to reuse the local gateway's values.
6. Optional: set a **Webhook secret** equal to the one in your DreamPay panel. The webhook URL is `https://your-site.com/wp-json/dreampay/v1/ipn` (the plugin sends it automatically with every payment).

== Frequently Asked Questions ==

= My store currency is USD/EUR. Can I still take bKash? =

Yes. Set the exchange rate on the local gateway (1 store currency = ? BDT). The customer is charged the converted BDT amount. The same applies to the international gateway when your store currency is not USD.

= The order is "On hold" after payment =

DreamPay reported the payment as PENDING (for example, the SMS has not reached the server yet) or the paid amount was lower than expected. The order updates automatically when the webhook arrives; you can also click **Re-check payment** on the order screen.

= How do refunds work? =

Clicking "Refund via DreamPay" records the refund on your DreamPay server. Mobile financial service refunds (bKash, Nagad, Rocket, Upay…) are **not** sent automatically — send the money to the customer's number yourself. Card/PayPal refunds are processed by DreamPay where the gateway supports it.

= Does it work with UddoktaPay? =

The API is UddoktaPay-compatible, so it should work with any UddoktaPay-compatible server by changing the URL and key.

== Changelog ==

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
