=== Logicoo Form Payments & Shop ===
Contributors: logicoo
Tags: payment form, stripe, paypal, donation, woocommerce
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Online payments (Stripe, PayPal) and optional WooCommerce integration for Logicoo Form.

== Description ==

Free add-on for the Logicoo Form plugin. It adds online payments to your forms (Stripe one-off payments, Stripe Subscriptions, Apple Pay/Google Pay, PayPal one-off payments, PayPal Subscriptions) and an optional WooCommerce integration that creates orders from form submissions (dynamic amount or mapping to real catalog products), which can also prefill the checkout address with the address written in the form.

Requires Logicoo Form 1.1.0 or later. With an older Logicoo Form the add-on does not start and shows a notice until Logicoo Form is updated.

No sensitive card or payment data ever passes through or is stored on your site: payment details are always collected by the official Stripe/PayPal components running in the visitor's browser.

== Installation ==

1. Install and activate the Logicoo Form plugin.
2. Install and activate this add-on.
3. Enter your Stripe/PayPal keys in the add-on settings (Logicoo Form → Payments).
4. Add a "Payment" field to a form from the builder — one field per form.
5. (Optional) If you use WooCommerce, enable the integration from the "Payments — WooCommerce integration" box in the form editor and choose the order model (dynamic amount or mapping to real catalog products).

== Frequently Asked Questions ==

= Is WooCommerce required? =

No. The payments module (Stripe/PayPal directly on the form) works on its own on a site without e-commerce. The WooCommerce integration is an optional extra layer, active only if the WooCommerce plugin is installed.

= Does card data pass through my site or my server? =

No. Payment details are always collected by the official Stripe (Payment Element) or PayPal components running in the visitor's browser — your site only receives a transaction reference (id, status, amount, currency), never a card number.

= What happens with payment methods that open another page (Bancontact, Klarna, iDEAL…)? =

Just before such a payment, the add-on keeps a temporary copy of the visitor's answers (including a drawn signature and the chosen attachments) in the visitor's own browser (sessionStorage and IndexedDB of that tab's site). When the visitor comes back from the payment page, the form is filled in again and sent. The copy never leaves the browser, contains no payment data, and is deleted as soon as it has been used; a copy that was never used expires after one hour and is removed the next time a form with a payment field of the site is opened in that browser. If the browser cannot keep the copy (some private browsing modes), those payment methods are not started and the visitor is asked to pay by card, Apple Pay or Google Pay.

= What happens to a form with a Payment field if the add-on is not running? =

If Logicoo Form is older than the version this add-on requires, the add-on does not start but still blocks those forms: the Payment field shows that online payment is temporarily unavailable and the form cannot be sent. If you deactivate or delete the add-on, Logicoo Form no longer knows the Payment field and leaves it out, so the form would be sent without payment: remove the Payment field or unpublish the form first.

= How do refunds work? =

In this version, refunds are started from the Stripe or PayPal dashboard, not from wp-admin. The add-on receives the refund webhook and updates the transaction status automatically.

= Does the add-on support subscriptions? =

Yes, for both Stripe and PayPal: plans/prices are defined beforehand on the respective dashboard (Stripe Price ID or PayPal Plan ID) and selected in the builder — this add-on never creates plans dynamically through the API. Stripe prices must have a fixed amount: tiered and usage-based prices are not supported, and the Payment field shows a configuration error for them.

== External services ==

This add-on connects to third-party payment services to process payments. Connections happen only on pages that display a form containing a Payment field (the provider's script is loaded in the visitor's browser and, for Stripe subscriptions, your site reads the configured prices), when a visitor pays and submits such a form, and when the payment providers notify your site through webhooks.

= Stripe =

Used to process card, Apple Pay/Google Pay payments and subscriptions. The Stripe.js library is loaded from js.stripe.com in the visitor's browser (with your publishable key and the site language), and your site calls the Stripe API (api.stripe.com) to create, read and cancel unpaid payments and subscriptions, to read invoices, and to read the amount and currency of the subscription prices you configured (cached on your site for 7 days). Data sent: amount, currency, the form and field identifiers (as payment metadata), transaction references and, for subscriptions, the customer email. Card details go directly from the visitor's browser to Stripe and never reach your site.

* Service: [Stripe](https://stripe.com/)
* Terms of service: https://stripe.com/legal/ssa
* Privacy policy: https://stripe.com/privacy

= PayPal =

Used to process PayPal one-off payments and subscriptions. The PayPal JavaScript SDK is loaded from www.paypal.com in the visitor's browser (with your client ID and currency), and your site calls the PayPal REST API (api-m.paypal.com, or api-m.sandbox.paypal.com in sandbox mode) to create, capture and verify payments and subscriptions. Data sent: amount, currency, the form and field identifiers (as the order's custom ID), transaction references, plan identifiers and, for subscriptions, the subscriber email.

* Service: [PayPal](https://www.paypal.com/)
* Terms of service: https://www.paypal.com/legalhub/paypal/useragreement-full
* Privacy policy: https://www.paypal.com/privacy

== Screenshots ==

1. Configuring the "Payment" field in the form builder — gateway, mode (one-off or subscription) and amount.
2. The live payment form on the frontend, with the Stripe Payment Element.
3. Optional WooCommerce integration — mapping a form choice to a real catalog product.
4. The Transactions screen in wp-admin, with gateway, type, amount and status for each payment.

== Changelog ==

= 1.1.1 =
* Stripe: updated the bundled Stripe PHP library to version 22 (Stripe API 2026-09-30). Subscriptions use the current invoice payment model; nothing changes for visitors.
* Settings: the Stripe webhook description now lists the events to select in the Stripe dashboard.
* The "WooCommerce is not active" notice is shown only on Logicoo Form screens and on the Plugins screen.

= 1.1.0 =
* Requires Logicoo Form 1.1.0 or later. With an older version the add-on does not start and shows a notice instead of failing.
* Stripe: payment methods that open another page (Bancontact, Klarna, iDEAL…) now bring the visitor back to the completed form — answers, drawn signature and attachments — and send it once the payment has succeeded.
* WooCommerce: the checkout billing and/or shipping address can be prefilled with the address written in the form (per form, in the "Payments — WooCommerce integration" box).
* Builder: warning when the Total field shows fewer decimals than the payment currency uses.
* Stripe: tiered and usage-based prices are no longer offered with an amount of 0; the Payment field shows a configuration error instead.
* The Payments and Transactions screens follow the Logicoo Form menu. Translations are now provided by translate.wordpress.org.

= 1.0.1 =
* Stripe: the payment or subscription is now created only when the visitor clicks Submit, so editing the form no longer leaves unused "incomplete" payments in your Stripe dashboard.
* Stripe: when a payment is retried (declined card, closed 3D Secure window, changed amount or plan), the previous attempt is reused or cancelled instead of creating a new one.

= 1.0.0 =
* First public release.
* Stripe one-off payments (card, Apple Pay/Google Pay through the Payment Element) and Stripe Subscriptions with predefined plans (Price ID) on the builder's "Payment" field.
* PayPal one-off payments (PayPal Buttons) and PayPal Subscriptions with predefined plans (Plan ID).
* Stripe/PayPal webhook handling with signature verification and idempotency; transaction statuses: pending, succeeded, failed, refunded, active, suspended, cancelled.
* Admin screens: gateway/currency settings, read-only transactions list.
* Optional WooCommerce integration, per form: dynamic amount (no real product required) or mapping to real catalog products/variations — compatible with the classic checkout and the Checkout Block, and with High-Performance Order Storage (HPOS).
* No card or sensitive payment data passes through or is stored on your site.

== Upgrade Notice ==

= 1.1.1 =
Updated Stripe library. If you use Stripe subscriptions, make sure your Stripe webhook also sends the subscription and invoice events listed on the Payments settings page.

= 1.1.0 =
Requires Logicoo Form 1.1.0. Update Logicoo Form first, then this add-on.
