=== SynraPay for WooCommerce ===
Contributors: synrapay
Tags: payments, payment gateway, credit card, visa, mastercard, synra
Requires at least: 5.8
Tested up to: 6.6
Requires PHP: 7.2
Stable tag: 2.2.0
License: GPLv2 or later

Accept credit and debit card payments through SynraPay's hosted session —
SynraPay's own secure card fields inside your checkout. Install, paste your
Merchant ID and API key, and start taking payments — no code required.

== Description ==

SynraPay for WooCommerce adds a **Credit / Debit card** option to your
checkout. In the default *Hosted session* mode the customer types the card into
SynraPay's own secure fields, embedded in your checkout page: the card
never touches your store, 3-D Secure runs in an overlay, and your store confirms
the order server-to-server (Direct API, signature v2) before it is marked paid.
The final result is also delivered to your store via a signed webhook.

Features:
* Hosted session: SynraPay's own card fields on your checkout page (no redirect)
* Direct API, signature v2 — Merchant ID and API key stay on your server
* Optional hosted-checkout redirect mode and legacy embedded (S2S) mode
* Classic checkout AND Cart/Checkout Blocks
* Sandbox and Live environments
* SHA512-verified webhooks, reconciliation on return
* HPOS compatible

== Installation ==

1. Upload the `synra-pay` folder to `/wp-content/plugins/` (or upload the ZIP via
   Plugins → Add New → Upload Plugin) and activate it.
2. Go to **WooCommerce → Settings → Payments → SynraPay → Manage**.
3. Choose **Environment** (Sandbox / Live) and **Checkout mode** (Hosted session).
   Make sure your site's origin (for example https://shop.example) is registered
   on your SynraPay merchant, or the card session is refused.
4. Paste your credentials from **Synra Dashboard → Integrations → WooCommerce**:
   * Merchant ID (x-merchant-id)
   * API Key (signature key)
   * Webhook secret (KEY_SHA512) + Webhook API-Key name/value, from Developers → API Keys → Webhook Verification
5. Copy the **Webhook URL** shown on the settings screen into
   **Synra → Developers → Webhook URL**.
6. Enable the gateway and **Save**. Place a test order.

== PCI note ==

In Embedded mode the card number passes through your web server's memory for
one request and is never stored or logged. This places your store in PCI DSS
SAQ D scope. If you prefer to stay out of scope, choose Hosted checkout mode.
Live mode refuses to render the card form on a non-HTTPS page.

== Changelog ==

= 2.2.0 =
* SynraPay made its card-fields script (sdk.js) internal: a store page that loads it directly now gets "Something went wrong" and no card form. The card form is loaded through SynraPay's public hosted-session.js (SynraHostedSession.mount) instead. Environments are Sandbox and Live only (a store saved on Develop runs as Sandbox). The webhook secret is the one "Webhook secret (KEY_SHA512)" from Developers → API Keys; the per-endpoint Signing secret is gone from the portal.
* A card detail to fix no longer opens a new card session: the fields say what is wrong and keep what was typed.

= 2.1.10 =
* One transaction id: the Direct API order id is the Transaction ID shown on the merchant dashboard. The plugin records transaction_id from Direct API answers (falling back to order_id) and no longer reads synrapay_transaction_id.
* Webhook settlement of hosted-session orders takes the Transaction ID from the webhook body's transactionId; the extra status read that only fetched the id is gone.
* Order note and admin order screen show Merchant order ID, Transaction ID and auth code. The separate "SynraPay order ID" line is gone because it would repeat the Transaction ID.

= 2.1.9 =
* Hosted session: the WooCommerce transaction id is now SynraPay's Transaction ID (synrapay_transaction_id, as on the merchant dashboard) instead of the Direct API order id; the Direct API order id is kept as "SynraPay order ID" and still used for refunds and status reads.
* Webhook settlement of hosted-session orders makes one best-effort status read to fetch the Transaction ID; if it fails the order is still settled with the Direct API order id.
* Order note and admin order screen list Merchant order ID, Transaction ID, SynraPay order ID and auth code. The gateway reference is no longer stored or shown.

= 2.1.8 =
* A browser-sent "frame approved" is only honoured when SynraPay's status shows a payment attempt (gateway transaction or awaiting Mastercard); a failed status read keeps polling instead of parking the order.
* Hosted-session token must belong to the store's Environment (hs_live_/hs_test_/hs_dev_), refused with ENVIRONMENT_MISMATCH otherwise.

= 2.1.7 =
* Security review: same-origin + rate limits on the checkout endpoints, webhook timestamp and v2 signature mandatory, paid amount checked on webhooks, frame-approved orders stay pending (not on-hold) until SynraPay confirms, status reads throttled.

= 2.1.2 =
* Unguessable per-site webhook URL (wc-api=synra_pay_wh_<token>); "Webhook signing secret" label; refused webhooks logged.
* One loader while the card fields mount; a declined attempt no longer waits on the order status.

= 2.1.1 =
* Small right-aligned logo, visible radio, skeleton loader, logged-in email / saved phone fallbacks, gateway errors shown on the page and logged.

= 2.1.0 =
* Hosted session checkout mode (default): SynraPay's card fields (sdk.js) on the
  checkout page, Direct API create-order / hosted-session / status with
  signature v2, 3-D Secure overlay, server-side confirmation before payment_complete.
* Develop environment (dev-api.synrapay.com / dev.js.synrapay.com).
* Default title "Credit / Debit card".

= 2.0.0 =
* Embedded Synra card UI with server-to-server card submission.
* WooCommerce Blocks checkout support.
* Hosted redirect kept as an optional mode.

= 1.0.0 =
* Initial hosted-checkout release.
