=== Cryptoinfra Crypto Payments for WooCommerce ===
Contributors: spdjmedia
Tags: crypto, usdt, bitcoin, payment gateway, woocommerce
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.4
WC requires at least: 6.0
WC tested up to: 11.3
Stable tag: 1.1.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Take USDT, USDC, BTC and more for WooCommerce orders — on the Cryptoinfra payment page or embedded in your own order page.

== Description ==

Cryptoinfra Crypto Payments adds a "Pay with crypto" method to your WooCommerce checkout (classic and block checkout).

* The order is priced in US dollars. A USD stablecoin is charged at exactly 1:1; any other coin at the live rate, locked when the customer picks it.
* The customer chooses the coin and its network (USDT, USDC, BTC, BNB, SOL, TON, TRX — on TRON, BNB Smart Chain, Solana, Bitcoin and TON) and pays, either on the Cryptoinfra payment page or on your own order page, where the payment page is embedded in a frame that fits your theme.
* The order moves to Processing when the payment is paid. An underpaid or late payment puts the order On hold with a note for you to decide; an expired payment cancels it.
* Every notification is verified with your callback secret, and the payment is then read back from Cryptoinfra with your API key before the order changes — a forged or replayed notification cannot mark an order paid.
* The money lands in your Cryptoinfra balance, minus your ordinary deposit fee. Nothing is added to your customer's price.
* HPOS (High-Performance Order Storage) compatible.

You need a Cryptoinfra merchant account and an API key.

== External services ==

This plugin connects to Cryptoinfra, the payment service that takes the crypto payment. It is needed for the plugin to work at all.

* **When:** at checkout, when a customer chooses to pay with crypto (the plugin creates a payment); when the customer returns to your thank-you page and when Cryptoinfra notifies your store (the plugin reads the payment back); and when you save the settings without a callback secret (the plugin fetches it).
* **What is sent:** your API key (to authenticate), the order reference, the order total in US dollars, a short description ("Order #1001"), the customer's billing email (so Cryptoinfra can send a receipt), your store's thank-you and notification URLs, and the order and install ids. No card or bank data is involved.
* **Where:** the Cryptoinfra API (`https://api.cryptoinfra.build`, or `https://merchant.cryptoinfra.build/sandbox` in sandbox mode).
* **The payment page:** the customer pays on `https://pay.cryptoinfra.net`, either after a redirect or — when "Payment page" is set to Embedded — in a frame of that page on your order page. That page is loaded in the customer's browser from Cryptoinfra.

Cryptoinfra terms of service: https://cryptoinfra.net/terms
Cryptoinfra privacy policy: https://cryptoinfra.net/privacy

== Installation ==

1. Upload the plugin and activate it (WooCommerce must be active).
2. Make sure the store currency is US Dollar (WooCommerce → Settings → General).
3. WooCommerce → Settings → Payments → Cryptoinfra: paste your API key, tick Sandbox if it is a sandbox key, and save. The callback secret is fetched with the key when you leave it empty; you can also paste it from Payments → Gateway settings in the Cryptoinfra dashboard.
4. Enable the method.

== Frequently Asked Questions ==

= Can the customer pay without leaving my store? =

Yes. Set "Payment page" to "Embedded on your site". After placing the order the customer lands on your order's pay page, with the Cryptoinfra payment page inside it; once paid they are taken to your thank-you page. "Embedded theme" picks light or dark to match your store, or follows the customer's device.

= Why does the method not show at checkout? =

The gateway prices in US dollars only. It is offered when the store currency is USD, the method is enabled, and an API key is saved. The settings page tells you when the currency is the reason.

= How do I test without real money? =

Create a sandbox API key in the Cryptoinfra dashboard, tick "Sandbox" in the plugin settings and save the sandbox key. Sandbox payments are paid with fake money from the sandbox; nothing real moves. Switch Sandbox off and save a live key to go live.

= What is the callback secret? =

Cryptoinfra signs every payment notification it sends to your store with your project's callback secret (an HMAC-SHA256 signature). The plugin refuses a notification whose signature does not match. Find it under Payments → Gateway settings in the dashboard, or leave the field empty and save: the plugin fetches it with your API key. If you rotate the secret in the dashboard, save the new one here too.

= My store is not on https. Does it still work? =

Notifications are only sent to an https address. Without https the order is still updated when the customer returns to your thank-you page, because the plugin reads the payment back from Cryptoinfra there; an https store is strongly recommended.

= Can one Cryptoinfra project serve several stores? =

Yes. Give each store its own "Order id prefix" (for example `shop1-`) so their order numbers never collide.

= The order total changed after the customer started paying. =

A payment is fixed to one price. When the customer pays again for a changed order, the plugin opens a new payment under a new reference (the order number with a "-2" suffix). If money arrives on the earlier payment, the order is put On hold with a note instead of being completed.

== Changelog ==

= 1.1.1 =
* Ready for the WordPress.org directory: requests go through the WordPress HTTP API, the embedded payment page uses the plugin's own bundled script, classes renamed Cryptoinfra_WC_Gateway and Cryptoinfra_WC_Blocks, and the readme lists the external service with its terms and privacy policy.

= 1.1.0 =
* Embedded payment page: a "Payment page" setting to show the Cryptoinfra payment page inside your own site (it fits any width and is as tall as the page), or redirect as before. "Embedded theme": light, dark or automatic.
* Payment pages open on pay.cryptoinfra.net.

= 1.0.0 =
* First release: hosted checkout, verified and re-read notifications, return-page check, block checkout, HPOS support.
