=== Gyvar Payments ===
Contributors: gyvar
Tags: payments, bitcoin, stablecoins, woocommerce, mobile money
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.1.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Take payments in Bitcoin and stablecoins on WordPress and WooCommerce.

== Description ==

Gyvar Payments puts a Pay button on your WordPress site and adds a payment
gateway to WooCommerce. Your customer pays from a Bitcoin or stablecoin balance;
the money lands in the account you nominate.

What this plugin does:

* A **Pay button** block and `[gyvar_pay]` shortcode, pointing at a payment link
  you created in your Gyvar dashboard. No API key needed.
* A **webhook receiver**, so your site is told when a payment completes. Every
  delivery is signature-verified and deduplicated before anything acts on it.
* A **WooCommerce payment gateway**. Your customer picks Bitcoin and stablecoins
  at checkout, pays on a page Gyvar hosts, and the order is marked paid by a
  signed webhook - not by the customer coming back, so a closed tab still
  delivers the goods. Works with both the classic and the block checkout.

You need a Gyvar account. The Pay button also needs a payment link from your
Gyvar dashboard; the WooCommerce gateway does not, because it creates a Gyvar
order for each checkout. Fees, corridors and settlement are configured in your
Gyvar dashboard, not here.

== External services ==

This plugin communicates with Gyvar, operated by Gyvar, Inc.

* **The Pay button** renders a link to `pay.gyvar.com`. Nothing is sent from your
  server; your visitor's browser loads that page when they click.
* **The connection test** on the settings screen sends a signed request to
  `api.gyvar.com/v1/whoami`. It contains your key id, a timestamp, a nonce and a
  signature. It moves no money and returns which key authenticated.
* **The WooCommerce gateway** sends a signed request to
  `api.gyvar.com/v1/checkout/orders` when a customer checks out with Gyvar. It
  contains the order number and total, the currency, your site name and the
  return URLs. It sends no customer name, email or address.
* **The webhook receiver** accepts inbound requests from Gyvar at
  `/wp-json/gyvar/v1/webhook` and verifies their signature. It sends nothing.

No visitor data is transmitted to Gyvar by this plugin. Terms:
https://gyvar.com/legal/terms - Privacy: https://gyvar.com/legal/privacy

== Installation ==

1. Install and activate the plugin, then go to Settings > Gyvar Payments.
2. For webhooks, register the endpoint URL shown on the settings screen in your
   Gyvar dashboard and paste the signing secret it gives you.

For WooCommerce:

3. Generate a key on the settings screen, upload its public key in your Gyvar
   dashboard with Read and Receive, and paste the key id back.
4. In your Gyvar dashboard, under Settings > Payment links, add your shop's
   address as a return address.
5. Enable Gyvar under WooCommerce > Settings > Payments.

For the Pay button:

3. Create a payment link in your Gyvar dashboard and paste its slug.
4. Add the Pay button block to a page, or use `[gyvar_pay slug="your-slug"]`.

== Frequently Asked Questions ==

= Does uninstalling revoke my API key? =

No. Uninstalling deletes the key from this site, but the key stays registered on
Gyvar until you revoke it in your dashboard. Revoke it there first.

= Why does the connection test say ip_not_allowed? =

The key has an IP allowlist and your server called from another address. The
error message includes the address Gyvar saw; add that one. A store key needs
only read and receive, and those keys do not require an allowlist.

= Is the WooCommerce gateway ready? =

Yes. It takes live payments on production stores. Use test mode to try it on
your own store before you switch to live.

= How do Gyvar statuses map to WooCommerce orders? =

* paid: Processing.
* paid late (after expiry): Processing, even if already Cancelled. Check stock.
* expired or cancelled: Cancelled.
* underpaid and declined: Failed. The money is still in your Gyvar wallet.
* underpaid, not yet decided: stays On hold. Decide in your Gyvar dashboard.
* escalated for review: stays On hold until Gyvar resolves it, then follows the
  outcome (paid, or failed if closed or cancelled).
* superseded by a newer payment: left as it is. Refund the extra in Gyvar.
* refunded: unchanged. Refund in WooCommerce by hand.

A paid order is never un-paid by a later event.

== Changelog ==

= 0.1.1 =
* BTC, USDT and USDC logos beside the payment method at checkout.
* The WooCommerce settings screen shows test or live mode, whether a key
  and webhook secret are set, and the setup steps above the settings.

= 0.1.0 =
* First release: Pay button block and shortcode, signature-verified webhook
  receiver, settings screen with key generation and a connection test.
* WooCommerce gateway for the classic and block checkout, with orders updated
  by signed webhook. Not yet run against a live store.
