=== gigstack for WooCommerce ===
Contributors: gigstack
Tags: spei, oxxo, payments, mexico, woocommerce, cfdi, facturacion, autofactura
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 1.1.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Accept SPEI, card and OXXO payments in WooCommerce through gigstack, with automatic CFDI invoicing or customer self-invoicing (auto-factura).

== Description ==

gigstack for WooCommerce adds a gigstack-powered payment method to your checkout:

* **SPEI** — the interbank transfer every Mexican bank supports, which no other WooCommerce processor plugin offers. Also **card** and **OXXO**, each toggleable in settings.
* At checkout, a gigstack payment link is created and the customer is redirected to a secure page with the payment options you enabled.
* The order stays on hold until gigstack confirms the payment, then it is marked as paid automatically via webhook (the plugin re-verifies against the gigstack API, never trusting the webhook body).
* **CFDI options**: automatic PUE invoice, PPD invoice + payment complement, or **auto-factura** — the plugin creates a gigstack receipt and shows the customer a self-invoicing portal link on the order page and in the confirmation email.
* Cancelling an order cancels the gigstack payment link.
* Works with both the classic checkout and the block-based checkout. Compatible with HPOS.

You need a gigstack account (https://gigstack.pro) with Stripe connected, and your store currency must be MXN.

== Installation ==

1. Upload the plugin and activate it.
2. Go to WooCommerce → Settings → Payments → gigstack.
3. Paste your gigstack API key, pick the payment methods and CFDI mode, and save. The payment webhook is registered automatically.

== Frequently Asked Questions ==

= Does this charge any extra fees? =
The plugin is free; gigstack/Stripe processing fees apply per your gigstack plan.

= Can it invoice automatically (CFDI)? =
Yes — choose PUE invoice, PPD invoice + payment complement, or auto-factura (the customer generates their own CFDI from a portal link).

= Which payment methods can I offer? =
SPEI (transferencia), card, and OXXO — any combination, all collected through your gigstack + Stripe account.

== Changelog ==

= 1.1.2 =
* The plugin and its updates now live on gigstack.pro instead of a separate site, so automatic updates work out of the box.

= 1.1.1 =
* The order page now tells a customer who has just paid that confirmation can take up to a minute, with a link to refresh, instead of only showing "complete your payment".

= 1.1.0 =
* A customer returning from gigstack is no longer told to pay again when their payment already went through. gigstack returns them within seconds, but the confirmation arrives separately and can be delayed, retried, or blocked by the store's hosting — so the order page now checks the payment with gigstack before showing anything, and completes the order if it has been paid. This also means a lost notification repairs itself the next time the customer or merchant opens the order.

= 1.0.9 =
* Fixed a spurious "could not create the auto-factura receipt" note on paid orders. gigstack retries payment notifications, and two retries arriving together could both try to create the receipt; the second was rejected and logged as a failure even though the receipt existed. Receipt creation is now claimed by a single caller, and a rejected duplicate is treated as the desired outcome. Genuine failures are still reported.

= 1.0.8 =
* When you choose to keep customers on your store after checkout, the "Pagar ahora" link now opens in the same tab instead of a new one. gigstack returns them to the order page once the payment succeeds, so a second tab only left them with two copies of the same page.

= 1.0.7 =
* Checkout now goes straight to the gigstack payment page again, since gigstack returns the customer to the order page once the payment succeeds. Staying on your store is still available under "After checkout" if you prefer the customer to leave checkout holding an order number — worth considering when most customers pay by SPEI or OXXO.

= 1.0.6 =
* Fixed checkout failing on stores whose address gigstack will not accept as a return URL (http, an IP, or a private/local hostname). The return URL is now validated before it is sent, and if gigstack rejects it the payment is retried without it — collecting the payment always takes priority over returning the customer.

= 1.0.5 =
* gigstack now returns the customer to your order page after a successful payment, so the "After checkout" setting explains the real trade-off: staying on your store remains the default because SPEI and OXXO are paid later, while sending the customer straight to the payment page is a good fit for card-only stores.

= 1.0.4 =
* Sends the store's order-received page to gigstack as the return URL, so once the platform change ships the customer is taken back to your store automatically after paying. Only sent from https stores.

= 1.0.3 =
* Customers are no longer stranded after paying. The gigstack payment page has no way back to the store, so sending the customer there directly left them on a page with no order number and no confirmation. Checkout now finishes on your own order-received page, which shows the order and opens the payment page in a new tab. The old behaviour is still available under "After checkout" if you prefer it.

= 1.0.2 =
* Order completion no longer fails when another plugin misbehaves. Tutor LMS returns null from the `woocommerce_payment_complete_order_status` filter when its auto-complete setting is off, which made `payment_complete()` throw and caused every incoming payment notification to fail with HTTP 500 — leaving paid orders stuck on hold. The plugin now pins a valid status at the end of the filter chain and never lets a third-party error turn a confirmed payment into a failed webhook.
* `process_payment()` no longer assumes a cart exists, so paying for an existing order from My Account works.

= 1.0.1 =
* Fixed a fatal error on sites that also run the legacy "Gigstack WooCommerce Integration" plugin. Both declared the class WC_Gateway_Gigstack, which took the whole site down. All classes are now uniquely prefixed and the gateway id is `gigstack_checkout`, so the two can run side by side.
* The plugin now refuses to load, with an admin notice, if any of its class names is already taken — a conflict can no longer white-screen a store.

= 1.0.0 =
* Initial release: SPEI/card/OXXO checkout via gigstack payment links, webhook confirmation with API re-verification, auto-cancel, CFDI automations, auto-factura self-invoicing, blocks + HPOS support.
