=== PushinPay Gateway for WooCommerce ===
Contributors: gustavosoriano, davidbalbino
Tags: payments, woocommerce, pix, payment-gateway, brazil
Requires at least: 6.8
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 0.1.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Accept PIX-only payments in WooCommerce through PushinPay.

== Description ==

PushinPay Gateway for WooCommerce connects your WooCommerce store to PushinPay so customers can pay orders with PIX only.

When a customer chooses PushinPay at checkout, the plugin creates a PIX charge through the PushinPay API, shows the QR Code and copy-and-paste PIX code on the order received page, and confirms the WooCommerce order when PushinPay sends the payment webhook.

The plugin also includes a manual "I already paid" check on the order received page and a WP-Cron fallback that can check pending PIX orders if webhook delivery is delayed.

== Requirements ==

* WordPress 6.8 or higher.
* WooCommerce installed and active.
* PHP 7.4 or higher.
* Store currency set to BRL.
* A valid PushinPay API token.

== External services ==

This plugin connects to PushinPay, a payment gateway service, to create and check PIX payment charges for WooCommerce orders.

The plugin sends data to PushinPay only when the store owner has configured a PushinPay API token and a customer chooses PushinPay as the payment method during checkout. The data sent can include the order amount in cents, a charge description containing the WooCommerce order number, the store webhook URL, an optional PIX expiration time, and optional split rules configured by the store owner in this plugin.

PushinPay returns a transaction ID, PIX QR Code data, a copy-and-paste PIX code, payment status information, and webhook notifications used to update the WooCommerce order status.

Service provider: PushinPay.

Terms of use: https://pushinpay.com.br/termos-de-uso

Privacy policy: https://pushinpay.com.br/politica-de-privacidade/

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/`.
2. Activate the plugin through the Plugins screen in WordPress.
3. Go to WooCommerce > Settings > Payments.
4. Open PushinPay.
5. Enable the gateway and enter your PushinPay API token.
6. Save the settings and make sure your WooCommerce currency is BRL.

== Frequently Asked Questions ==

= Do I need to configure a webhook manually? =

No. The plugin sends the store webhook URL to PushinPay when it creates each PIX charge.

= Which webhook URL is used? =

The current webhook endpoint is `/wp-json/pushinpay/v1/webhooks/pix`. New PIX charges use a signed per-order webhook URL. The legacy endpoint `/wp-json/pushinpay/notificacoes` is also kept for backward compatibility and requires the `x-pushinpay-token` header configured in the gateway settings.

= Does the plugin confirm orders without a webhook? =

Webhook delivery is the primary confirmation method. The plugin also includes a manual payment check button and a WP-Cron fallback for pending PIX orders.

= Does the plugin load assets from external CDNs? =

No. JavaScript, CSS, and images used by the plugin are included locally.

== Privacy ==

This plugin does not send data to PushinPay until the store owner configures a PushinPay API token and a customer chooses PushinPay during checkout.

For PIX payments, the plugin stores the PushinPay transaction ID, QR Code image data, copy-and-paste PIX code, payment method marker, and confirmation timestamp as WooCommerce order metadata.

== Changelog ==

= 0.1.4 =
* Aligns the PIX creation and webhook flow with the current PushinPay API.
* Uses the WordPress HTTP API instead of direct cURL calls.
* Adds nonce checks to AJAX payment verification.
* Adds a documented external services section.
* Removes legacy unused payment methods and development files.
* Renames the main plugin file to match the WordPress.org slug.

= 0.1.3 =
* Focuses the gateway on PIX payments.
* Updates gateway logos.

= 0.1.0 =
* Initial release.
