=== Orrerie Pay for WooCommerce ===
Contributors:
Tags: woocommerce, crypto, payments, bitcoin, stablecoin
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.7
License: GPLv2 or later

Take crypto payments in WooCommerce. The money lands in your own two-of-three wallet; Orrerie never holds it.

== Description ==

Orrerie Pay for WooCommerce adds a crypto payment method to your shop's checkout. It connects your shop to Orrerie Merchant, where your business has its own wallet.

Orrerie Merchant lets a business take crypto payments by link, invoice, till, subscription, WooCommerce or API. By default each order gets its own address, and money arrives in the merchant's own two-of-three wallet on eleven networks. Orrerie holds one key of three, so it can never move it alone.

= How it works for a shopper =

1. The shopper chooses the crypto payment method at your checkout and places the order.
2. The shopper is sent to the Orrerie checkout page for that order. There the shopper taps Pay with Orrerie, or chooses a coin and a network and pays the address shown, by QR code or by copying it.
3. When your own wallet shows the money on the network, the order in WooCommerce is marked paid, with a note that names the coin, the network and the transaction.

= What you should know =

* You need an Orrerie Merchant account. A business signs up in a browser with an email address and a passkey; signing up costs nothing.
* Every wallet needs two of three keys: your browser key, the recovery key in your Orrerie app and Orrerie's server. Orrerie holds one, so it cannot move your money alone.
* By default a shopper who does not use the Orrerie wallet pays an address made for that one order. Relay, a separate company, converts on the way and delivers into your own wallet in the coin you chose. While a payment is being converted it is with Relay for seconds to minutes.
* Litecoin and Dogecoin are not covered by Relay and arrive unconverted.
* An order is marked paid only when your own wallet shows the money, never because the shopper's browser came back to your shop.
* Orrerie's fee is 0%, and any change is announced 30 days ahead. By default, on a converted payment the routing and network cost is shown to the shopper at the checkout as its own line and the shopper pays it; you can choose to absorb it instead.
* You can sell at once: up to US$250 for each of your first 3 paid orders, then US$1,000 an order and US$5,000 in any 30 days, until US$20,000 of paid orders in total. A business check raises that to US$50,000 and US$250,000. Your customers are never asked who they are.
* There is no outside security audit of Orrerie Merchant. Its security reviews are in-house.

= Refunds =

A refund started in WooCommerce is sent to Orrerie Merchant as a request. A person at your business approves it there with a passkey. WooCommerce records the refund when it is confirmed, and not before.

= Subscriptions =

Renewals are not charged by this plug-in: a crypto payment is always sent by the payer. With WooCommerce Subscriptions in manual-renewal mode, each renewal order is paid by the customer through this payment method.

== Installation ==

1. In Orrerie Merchant, under Developers, API keys, make a restricted key for the shop with exactly these scopes: checkout_sessions:write, orders:read, payments:read, refunds:write, events:read, webhooks:write. payments:read only lets the plug-in name the coin, network and transaction in a paid order's note. Make a test key first.
2. Install the plug-in and activate it. WooCommerce must be active.
3. In WooCommerce, open Settings, then Payments, then Orrerie Pay. Paste the test key and save: the plug-in adds your shop's test webhook endpoint at Orrerie Merchant and fills in its signing secret by itself.
4. Place an order in test mode and complete the simulated payment.
5. For live mode, add a live endpoint in Orrerie Merchant (Developers, Webhooks, with a passkey) for the address the settings page shows, paste the signing secret it shows and the live key, and switch Mode to Live. A live key cannot add an endpoint by itself.

Your shop's currency must be one Orrerie Merchant prices orders in: USD, EUR or GBP. Otherwise the payment method is hidden at checkout and its settings page says why.

The settings:

* Enabled
* Title
* Description
* Mode
* Test secret key
* Live secret key
* Test webhook signing secret
* Live webhook signing secret
* Order expiry
* Mark order as
* Debug log

== Frequently Asked Questions ==

= Who holds the money? =

You do. It arrives in your own wallet, which needs two of three keys. Orrerie holds one of them and cannot move the money alone.

= Do I need gas money to be paid? =

Not to be paid. A converted payment arrives in your own wallet, so there is nothing to collect from per-order addresses. Litecoin and Dogecoin arrive unconverted, in their own wallets. To send money out you need a little of the network's own coin on eight networks. The Solana and TRON wallets show no address until you switch them on (Solana for a fraction of a US dollar, TRON for 100 TRX plus about 1 TRX).

= Which coins and networks can a shopper pay with? =

The shopper chooses the coin and the network on the checkout page. Orrerie Merchant gives your business a wallet on eleven networks: Ethereum, BNB Smart Chain, Polygon, Arbitrum, Optimism, Base, Solana, TRON, Bitcoin, Litecoin and Dogecoin.

= When is the WooCommerce order marked paid? =

When your own wallet shows the money on the network. The plug-in then reads the order from Orrerie Merchant again before it changes anything in your shop.

= What if a shopper pays too little, or after the order has expired? =

The WooCommerce order is put on hold with a note that says what happened, so that you decide. An order left unpaid past its Order expiry is cancelled, and WooCommerce puts its stock back.

= Can I try it without real money? =

Yes. Test mode is simulated payments: set Mode to test and use your test secret key.

= Where are my keys kept? =

Sealed in your shop's database with your site's own secret keys from wp-config.php, so a copy of the database holds none of them. You can set them in wp-config.php instead (ORRERIE_PAY_LIVE_KEY, ORRERIE_PAY_LIVE_WEBHOOK_SECRET); they are then never stored.

= Does the plug-in work with the block-based checkout? =

Yes. It registers the payment method for the classic checkout and for the checkout block.

== External services ==

This plug-in connects your shop to Orrerie Merchant, a service of Orrerie. It cannot work without it.

* When a shopper places an order with this payment method, the plug-in sends the order's total, currency, order number, the shopper's email address and your shop's return addresses to the Orrerie Merchant API at api.orrerie.com, and sends the shopper's browser to the Orrerie checkout page at pay.orrerie.com.
* Orrerie Merchant sends your shop a signed message when the order is paid, and the plug-in then reads the order from the API before it changes anything.
* When you save a test key, the plug-in sends your shop's address to the API to add your test webhook endpoint.
* A refund started in WooCommerce is sent to the API as a refund request.

The terms and the privacy notice of the service:

* Orrerie Merchant Terms: https://wallet.orrerie.com/legal/merchant-terms
* Orrerie Privacy notice: https://wallet.orrerie.com/legal/privacy

== Screenshots ==

1. The plug-in's settings in WooCommerce.
2. The Orrerie checkout page the shopper is sent to.
3. A paid order in WooCommerce, with the note that names the coin, the network and the transaction.

== Changelog ==

= 1.0.7 =
* When Orrerie refuses to start a payment because the business has no confirmed support email, is closing, has a way to pay switched off, cannot use the settlement asset asked for, or has too many unpaid orders open, the order note says what to change in Orrerie Merchant.

= 1.0.6 =
* Your keys and signing secrets are sealed in the database with your site's own secret keys; keys saved before are sealed on update.
* Keys can instead be set in wp-config.php and are then never stored.

= 1.0.5 =
* The listing says the recovery key your Orrerie app makes and keeps, as the dashboard and the merchant pages do.

= 1.0.4 =
* Tested with WordPress 7.1 and WooCommerce 11.3.
* The TRON wallet's switch-on cost reads as the dashboard says it: 100 TRX plus about 1 TRX.

= 1.0.3 =
* A WooCommerce order is marked paid from Orrerie's own order alone. The coin, network and transaction its note names are read after it, with the key's new payments:read scope; with a key that lacks it the order is still marked paid and the note says why they are not named.
* The restricted key has six scopes: payments:read (read only) is added.
* A confirmed refund is marked recorded on the order before its note is written, so a resent event can never record it twice.
* This readme is the plug-in's WordPress.org listing text, word for word.

= 1.0.2 =
* A refund request whose answer was lost keeps its key until Orrerie answers it, so pressing Refund again can never file a second request for the same money.
* An event that could not be recorded or handled (a database error, an order WooCommerce could not save) is answered "try again later", so Orrerie sends it again.

= 1.0.1 =
* WooCommerce's Hold stock timeout waits for the Order expiry before it cancels an unpaid order.
* A payment undone by its network changes the order only when it is the payment that completed it.
* An order WooCommerce could not complete after a payment is put on hold with a note, never left pending.
* Events of orders made elsewhere (another shop, a payment link) are left alone without a call to Orrerie, which spares your API rate limit.
* A read refused by Orrerie's per-second limit is asked once more after a second or two instead of waiting for Orrerie's retry a minute later.

= 1.0.0 =
* First release.
