=== Refficks ===
Contributors: refficks
Tags: affiliate, referral, partners, woocommerce, tracking
Requires at least: 7.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.4.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Credit your partners for the sales and sign-ups they send you.

== Description ==

Refficks runs partner, affiliate and referral programmes. This plugin connects
your WordPress site to your Refficks account:

* With WooCommerce, it sends your orders and refunds to Refficks as they
  happen, so a sale through a partner's link or code credits that partner.
  Refficks decides what each order earns; the plugin only reports it.
* With WooCommerce, it makes your partners' discount codes as coupons when
  you sync them in Refficks, changes them when you change the discount, and
  moves a code that was paused, expired or used up to the trash. It never
  touches a coupon it did not make.
* With WooCommerce, when a programme gives every visit through a partner's
  link its own one-time code, it makes those codes as coupons good for one
  use, and puts the visit's code into the cart when the shopper adds
  something. It writes nothing to the shopper's browser to do it.
* It adds the Refficks tracking script to every page, so a visit that started
  with a partner's link is joined to that partner.
* It tells Refficks who signed up or logged in, so a partner's click joins the
  person even if they pay somewhere else later.
* With a cookie banner that uses the WP Consent API, the script waits until
  the visitor allows statistics (or marketing) cookies.

This plugin relies on Refficks, an external service. It needs a Refficks
account. What it sends, and when, is under External services below.

== External services ==

This plugin connects your site to Refficks (https://refficks.com), which runs
your partner programme: it is where partners' links, codes and commissions
live. Without Refficks the plugin does nothing.

Nothing is sent until somebody presses **Connect to Refficks** and approves
the connection in Refficks.

After that:

* **When you connect:** this site's address and name, and the versions of the
  plugin, WordPress, WooCommerce and PHP.
* **Every fifteen minutes:** the site's address, those versions, whether
  WooCommerce and the WP Consent API are active, and whether the tracking
  script is on, the store's currency, whether it takes coupon codes, which
  known caching or optimisation plugins are active (by name), and how many
  orders wait to be sent.
  No visitor, order or customer. At the same time, and when Refficks asks it
  to look, the plugin fetches the partner coupons and one-time coupons it
  should make, change or take away, and tells Refficks which it made, changed
  or could not make, and why.
* **On each page, in the visitor's browser:** the Refficks script, loaded from
  Refficks, records the visit with the partner's link it came from. It stores
  a visitor id and the partner's code in two first-party cookies. With the WP
  Consent API, nothing is stored or sent until the visitor consents.
* **When an order is placed, paid, refunded or cancelled (WooCommerce):** the
  order's number, status, amounts, products, coupon codes, what each refund
  returned, and the buyer's name, email address and country. Also the
  visitor id of the shopper's browser, so a sale with no code still credits
  the partner whose link they followed. Never their IP address, browser,
  street address, phone, shipping address or order note.
* **After somebody signs up or logs in:** their name, email address and
  WordPress user id, from their browser, on their next page.
* **When the plugin is deactivated, or you press Disconnect:** that it left.

Refficks never receives a visitor's IP address in full (only a salted hash of
it), street address or phone number.

* Terms of service: https://refficks.com/terms
* Privacy policy: https://refficks.com/privacy

== Installation ==

1. Install and activate the plugin.
2. Open **WooCommerce › Refficks** (or **Settings › Refficks** without
   WooCommerce) and press **Connect to Refficks**.
3. Sign in to Refficks and approve the connection. You come back to WordPress,
   connected.

== Frequently Asked Questions ==

= Does the plugin send my orders? =

Yes, with WooCommerce active. Each order goes to Refficks when it changes.
If Refficks cannot be reached, orders wait on your site and are sent again on
their own; the plugin's page says how many wait, and "Send unsent orders now"
sends them at once. Orders placed before you connected are not sent.

= What happens to a staging copy of my site? =

The plugin remembers the address it was connected at. On a copy with another
address it pauses itself, so test activity is not credited to partners.

= Which coupons does the plugin make? =

Only the codes somebody synced in Refficks, one coupon per partner's code,
each described as a Refficks partner code, and, when a programme gives every
visit its own code, those one-time codes, each good for one use and described
as a Refficks one-time code. A coupon already in your store with the same code
is left as it is, and Refficks shows that it was refused. The plugin moves its
own coupons to the trash when their code stops working, and leaves them in
your store if you delete the plugin.

= How does a one-time code get into the cart? =

A partner's link hands the visit's code on in the address it lands on. When
the shopper adds something to the cart from that page, from its own form or
from a product grid's button, the plugin puts the code in. If the shopper
allowed cookies, the Refficks script keeps the code, and the plugin puts it in
on the cart or checkout page too. It only ever puts in a one-time coupon it
made, and leaves a cart that already has a coupon as it is. A shopper who
declined cookies and browses to another page before adding anything has no
code in the cart: nothing was written down to carry it.

A page whose address carries a code asks caching plugins not to keep it, as
WooCommerce asks of the cart, so one shopper's code is never served to the
next.

= How do I disconnect? =

Press **Disconnect** on the plugin's page, or deactivate the plugin. Refficks
stops accepting this site's key at once. Deleting the plugin deletes
everything it kept.

== Changelog ==

= 0.4.0 =
* One-time codes: when a programme gives every visit through a partner's
  link its own code, the plugin makes each as a coupon good for one use, and
  puts the visit's code into the cart when the shopper adds something, so
  they get the discount without typing it. It writes nothing to the
  shopper's browser and sends nothing to Refficks to do it, and it only ever
  puts in a one-time coupon it made, never another code an address names.
  A page whose address carries a code asks caching plugins not to keep it.

= 0.3.3 =
* Connects to Refficks at go.refficks.com. Earlier versions named an
  address that does not exist, so pressing Connect could not reach Refficks.

= 0.3.2 =
* Deleting the plugin also deletes what it remembered of the last look at
  missed orders.

= 0.3.1 =
* The check-in names the caching or optimisation plugins active on the site,
  so Refficks can say which one is likely holding its script back.

= 0.3.0 =
* Makes partners' discount codes as WooCommerce coupons when they are synced
  in Refficks, keeps their discount up to date, and moves lapsed codes to the
  trash. Refficks can ask the plugin to look now, at /wp-json/refficks/v1/nudge.
* The check-in says which currency the store sells in.

= 0.2.1 =
* Needs WordPress 7.0 and, for orders, WooCommerce 10.9. The outbox's
  database queries name its table through WordPress's own placeholders.

= 0.2.0 =
* Sends WooCommerce orders and refunds, from an outbox that tries again until
  each is sent, with the shopper's visitor id kept on the order at checkout.

= 0.1.0 =
* Connect to Refficks, the tracking script with the WP Consent API, sign-ups
  and logins, and a check-in every fifteen minutes.
