=== PaidTerms for WooCommerce ===
Contributors: paidterms
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.5.2
License: GPL-2.0-or-later

Offer PaidTerms instalment financing as a payment method at WooCommerce checkout.

== Description ==

Adds PaidTerms as a payment option. When a customer chooses it, WooCommerce
creates its normal order and the customer is redirected to the PaidTerms-hosted
application. PaidTerms handles eligibility, the plan, fees, verification, legal
acceptance and repayments. Once PaidTerms confirms, the order moves to
Processing and the PaidTerms reference is recorded as an order note.

This plugin is a thin adapter. It contains no financing logic and stores no
payment details.

Product-page messaging is optional and defaults to Off, including for stores
upgrading from earlier versions. Choose Automatic for supported standard
WooCommerce product pages, or Manual placement to use the
[paidterms_financing_message] shortcode. This setting does not affect checkout.

== Installation ==

1. Plugins → Add Plugin (older WordPress: Add New) → Upload Plugin → choose
   paidterms-woocommerce-1.5.2.zip → Install Now → Activate Plugin.
2. WooCommerce → Settings → Payments → PaidTerms → Manage.
3. Paste the token PaidTerms issued for this store's exact web address, tick
   "Test connection", Save. A passed test names the PaidTerms business your
   orders will be financed for; a failed test says what to check.
4. Tick "Enable PaidTerms at checkout" and Save.
5. Product-page messaging stays Off by default. Choose Automatic or Manual
   placement only if you want to advertise PaidTerms on product pages.

Requires an NZD store. PaidTerms is offered for order totals (including GST and
shipping) of NZ$20.00 – NZ$20,000.00. Contact PaidTerms for a token.

Upgrading: upload the new ZIP and choose "Replace current with uploaded". Your
token and settings are kept, and every open PaidTerms order is re-checked.

== Order statuses ==

* Pending payment — the customer has not finished the PaidTerms application.
* On hold — "do NOT fulfil". Payment is set up (and possibly the first
  instalment collected) but PaidTerms has not approved the order, or financing
  was declined, or PaidTerms is reviewing it. The order note says which.
* Processing — PaidTerms approved the order for fulfilment. Fulfil as normal.
* Cancelled — you cancelled it; PaidTerms was told.

== Frequently Asked Questions ==

= Does PaidTerms change product pages by default? =
No. Product-page messaging defaults to Off, including after upgrading. The
checkout gateway works independently.

= How do I place the message manually? =
Choose Manual placement in WooCommerce > Settings > Payments > PaidTerms, then
add [paidterms_financing_message] where you want the message. The shortcode
only renders when the gateway is enabled, a token is configured and the store
uses NZD.

= What does Automatic placement do? =
It adds a small message before Add to Cart on product pages that use the
standard WooCommerce hook. Custom product templates may omit that hook; if so,
the message is not shown and the product page is unaffected.

= When does an order become Processing? =
Only when PaidTerms has explicitly approved it for fulfilment — after the
customer's first card instalment has been collected and PaidTerms has reviewed
it. Until then the order is On hold: do not fulfil it. If PaidTerms declines the
financing, the order stays On hold with a note for you to resolve.

= What happens if I cancel or refund a PaidTerms order? =
PaidTerms is told automatically. If financing has not started, the PaidTerms
link is switched off. If it has, PaidTerms records it for manual review and
contacts you; nothing is cancelled automatically.

= Can I deactivate the plugin with orders in progress? =
Yes. Deactivating changes no order and cancels nothing with PaidTerms, but new
customers cannot choose PaidTerms and status checks pause. When you re-activate,
every open PaidTerms order is checked again. Deleting the plugin removes its
settings (including the token) but keeps all orders and their notes.

= PaidTerms gave me a new token. =
Paste it into the token field and Save with "Test connection" ticked. The old
token stops working at once; orders placed with it keep working with the new one.

= PaidTerms does not appear at checkout. =
Check, in order: the gateway is enabled; a token is saved and the connection
test passes; the store currency is NZD; the cart total is between NZ$20 and
NZ$20,000. If checkout shows "temporarily unavailable", PaidTerms has paused new
financing or this store's plugin needs updating — contact PaidTerms.

= What if a customer abandons the application? =
The order stays Pending. Use "Check PaidTerms status" on the order screen at any
time, or review it in your PaidTerms dashboard. Nothing is cancelled
automatically.

== Changelog ==

= 1.5.2 =
* Remove checkout reassurance tick items for a simpler payment-method panel.
* Use the requested concise description at checkout and in the optional product-page message.
* Show the PaidTerms wordmark with the optional product-page term headline.
* Migrate the previous untouched description default while preserving merchant-customized text.

= 1.5.1 =
* Update the checkout title and description with the 3-, 6- and planned
  9-month messaging, NZ business eligibility, approval and repayment details.
* Update the optional product-page message with the same terms, while
  qualifying that eligibility is assessed for the full order.
* Migrate untouched old checkout title and description defaults; preserve
  merchant-customized wording.

= 1.5.0 =
* Product-page messaging is independently controlled and Off by default,
  including for existing stores upgrading from earlier versions.
* Add Automatic placement on the standard WooCommerce product hook and Manual
  placement with [paidterms_financing_message].
* Remove product-level price checks and estimates. The message describes
  eligibility for business orders; the order is assessed at checkout.
* Load product-message CSS only when an optional message can be rendered.
* Update checkout title and approved copy, with a one-time migration for
  untouched defaults only; merchant wording, credentials and gateway state are preserved.

= 1.4.0 =
* PaidTerms now tells the plugin, every 15 minutes in the background, whether
  to offer PaidTerms at your checkout (for example while your account is being
  activated, or if PaidTerms pauses applications), plus the amount range and
  approved wording. Your checkout never waits for PaidTerms, your own wording
  always wins, and existing orders are never affected.
* New plugin versions appear under Dashboard → Updates like any other plugin.
  Nothing installs until you click Update (or turn on auto-updates yourself),
  and a download that doesn't match PaidTerms' published checksum is refused.
* The PaidTerms application opens with the customer's name, phone and company
  search already filled in from the order, plus an "Order #… from your store"
  line. No street address or prices are sent.
* Store health (plugin, WordPress, WooCommerce and PHP versions) is reported so
  PaidTerms support can help you faster.
* Clear settings-screen messages when PaidTerms has paused your store or all
  WooCommerce applications.

= 1.3.2 =
* Test connection always shows which PaidTerms business your orders will be
  financed for. In 1.3.1 that line disappeared whenever the test also had a
  warning (for example, your account not yet activated), because WooCommerce
  shows either its warnings or its success messages, never both.

= 1.3.1 =
* Test connection now confirms which PaidTerms business the token belongs to
  and that this store's address matches the address the token was issued for
  (for example www vs no-www), instead of only that the token is valid. It
  also says when your PaidTerms account is not yet activated or when
  PaidTerms is not accepting new applications.
* A connection test that fails because of the token or the store address
  switches PaidTerms off at checkout until a test passes, so buyers never see
  a PaidTerms option that cannot work. Network errors never switch it off.
* Manual-review order notes say why in plain words (for example "a refund or
  dispute was recorded"), with the PaidTerms code kept for support.
* Tested with WordPress 7.1 and WooCommerce 11.2.

= 1.3.0 =
* Checkout and product pages no longer show an estimated "Pay from $X"
  amount or a plan length: the plugin quotes no amount, term or fee. The
  customer sees the full schedule on the PaidTerms application. Untouched
  default wording is updated automatically.
* Sends its version to PaidTerms; PaidTerms only starts new financing from
  1.3.0 or later.
* "Manual review" is no longer final: checks continue, so an order PaidTerms
  later approves moves to Processing without a manual step.
* Upgrading or re-activating re-checks every open PaidTerms order, including
  orders placed under 1.0/1.1 whose checks had stopped.
* A partial refund is reported to PaidTerms for manual review.
* Release to Processing is serialised per order, so two simultaneous checks
  cannot both release it, and a cancellation a moment earlier wins.
* No "on hold until we confirm payment" customer email for declined or
  under-review orders.
* Hold-stock exemption only for orders PaidTerms actually holds.
* Clearer connection-test messages; the settings screen shows which token is
  installed (its non-secret prefix).
* Uninstall removes the plugin's settings and queued checks (orders are kept).

= 1.2.0 =
* Orders wait On hold until PaidTerms approves them for fulfilment; only then
  do they move to Processing. Declined financing leaves the order On hold.
* Cancelling or refunding a PaidTerms order tells PaidTerms (with retries).
* Status checks continue every 6 hours for up to 14 days while an order awaits
  approval, instead of stopping after 24 hours.

= 1.1.0 =
* PaidTerms is offered only for order totals between NZ$20.00 and NZ$20,000.00
  (the PaidTerms per-invoice range, which PaidTerms also enforces).
* Clear buyer messages when PaidTerms has paused new financing, or is still
  preparing an order that was submitted twice.

= 1.0.0 =
* First pilot release.
