=== PIX Instant Payment Gateway ===
Contributors: piximpay
Tags: pix, woocommerce, payment gateway, brazil, qr code
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Accept PIX in WooCommerce with a QR code and copy-and-paste code for the exact order total, receipt uploads and auto-cancel of unpaid orders.

== Description ==

PIX Instant Payment Gateway adds PIX, the instant payment system of the Banco Central do Brasil, to your WooCommerce store. Money goes straight to your own bank account: there is no intermediary and no fee per sale.

When the customer places an order, the plugin generates a BR Code (the official PIX "copy and paste" format) with your PIX key, the exact order amount and a transaction ID, and draws the QR code on your own server. Nothing is sent to third-party services.

**For your customers**

* QR code and copy-and-paste code on the order received page, in My Account and in the order email.
* One-click "Copy code" button that works on phones.
* Countdown to the payment deadline.
* The page updates by itself as soon as you confirm the payment.
* Upload of the payment receipt (JPG, PNG, WebP or PDF).

**For you**

* Works with CPF, CNPJ, email, mobile phone and random (EVP) keys, with CPF/CNPJ check-digit validation.
* WooCommerce > PIX Payments screen with every PIX order, receipts, deadlines and one-click "Confirm payment" or "Cancel order" (also in bulk).
* "PIX payment" box and "Confirm PIX payment received" action on the order screen.
* Email notification when a receipt is uploaded. Receipts are stored in a private folder and can only be opened by shop managers.
* Unpaid orders are cancelled automatically after the deadline you choose, and stock goes back to your inventory. Orders with a receipt can be kept for review.
* Classic checkout and Cart & Checkout blocks. Compatible with High-Performance Order Storage (HPOS).
* Translation ready.

The Pro version connects to Mercado Pago or PagBank to create a dynamic PIX charge for each order and confirms payments automatically through webhooks (with a polling backup), so there is nothing to check by hand. Refunds made in WooCommerce are sent to the provider, and refunds made at the provider are reflected in the order.

== Installation ==

1. Install and activate WooCommerce, and set the store currency to Brazilian real (BRL).
2. Upload the plugin to `/wp-content/plugins/pix-instant-payment-gateway/` or install it from the Plugins screen, then activate it.
3. Go to WooCommerce > PIX Payments > Settings and enter your PIX key type, PIX key, receiver name and city.
4. Go to WooCommerce > Settings > Payments, enable PIX and adjust the title and description shown at checkout.
5. Place a test order and scan the QR code with your bank app to check the receiver data.

== Frequently Asked Questions ==

= Do I need an account with a payment company? =

No. The free version uses your own PIX key. Customers pay directly to your bank account and you confirm the payment in WooCommerce > PIX Payments after you see it in your bank app.

= How do I know which transfer belongs to which order? =

Each code carries a transaction ID made of your prefix and the order number (for example WC1234). Most banks show it in the transfer details. The amount is also fixed for each order.

= What happens if the customer does not pay? =

The order stays "On hold" until the deadline (24 hours by default). After that it is cancelled automatically and the stock is restored. Set the deadline to 0 to turn this off.

= Where are the receipts stored? Are they public? =

In `wp-content/uploads/pix-instant-payment-gateway-proofs/` with random file names and deny rules for Apache. Shop managers open them through a protected link in the admin. On Nginx you can add a `deny all` rule for that folder for extra protection.

= Why doesn't PIX show at checkout? =

PIX appears only when the gateway is enabled, the PIX key, receiver name and city are valid, and the store currency is BRL.

= Does it work with the block checkout? =

Yes, both the classic shortcode checkout and the Cart & Checkout blocks are supported.

= What is removed when I delete the plugin? =

Settings and scheduled tasks are always removed. If you enable "Delete uploaded receipts and PIX order data" in the settings, receipts and PIX order details are removed too. Orders themselves are never deleted.

== Screenshots ==

1. PIX QR code, copy-and-paste code and receipt upload on the order received page.
2. WooCommerce > PIX Payments list with confirm and cancel actions.
3. PIX settings: key, receiver, deadline and receipts.
4. PIX payment box on the order edit screen.

== Changelog ==

= 1.0.1 =
* PIX is turned on at checkout automatically the first time the receiver details are saved, and the PIX screen warns when the gateway is turned off.
* Cleaner admin menu (no separate Contact Us item).

= 1.0.0 =
* First release: BR Code and QR code generation, classic and block checkout, receipt uploads, manual confirmation, automatic cancellation of unpaid orders.
