=== Vefri Connect ===
Contributors: vefri
Tags: woocommerce, returns, orders, integration, vefri
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connect WooCommerce to Vefri. Sync orders, customers, and return requests for evidence-backed refunds.

== Description ==

[Vefri](https://vefri.io) helps D2C brands stop return fraud with delivery and return video evidence. **Vefri Connect** links your WooCommerce store to Vefri so ops can work from one place.

**What you get**

* Sync **orders** when they are created or updated
* Sync **customers** when they are created or updated
* Collect **return requests** from My Account and the WooCommerce admin returns screen, then sync status changes to Vefri
* Keep refund decisions with your team in the Vefri dashboard, with optional evidence workflows

**How Connect works**

A free Vefri account is required for cloud sync. When you click Connect, the plugin creates WooCommerce REST API keys (read/write), registers store webhooks, and completes a handshake with the Vefri API. If the API is briefly unavailable, local return requests still work in WordPress; outbound sync resumes once the handshake succeeds.

This plugin does not lock built-in return tools behind a paid unlock. Cloud sync runs on Vefri’s service after you connect.

**Requirements**

* WordPress 6.2 or higher
* WooCommerce (must be active before you activate this plugin)
* PHP 7.4 or higher
* A Vefri account at https://vefri.io

== Installation ==

1. In your WordPress admin, go to **Plugins → Add New**.
2. Search for **Vefri Connect**, then click **Install Now** and **Activate**. (WooCommerce must already be active.)
3. Go to **WooCommerce → Vefri Connect**.
4. Sign in or create a free account at [vefri.io](https://vefri.io), then click **Connect** in the plugin settings. Leave the API URL as the default unless your Vefri team gave you a custom endpoint.
5. Finish any pairing steps shown in your Vefri dashboard. Orders, customers, and return requests will start syncing.

== Frequently Asked Questions ==

= Does this require WooCommerce? =

Yes. The plugin will not activate without WooCommerce.

= Do I need a Vefri account? =

Yes, for order/customer/return sync to the Vefri dashboard. Sign up at https://vefri.io. Local return capture in WordPress still works without a live handshake; pushes to Vefri wait until the store is connected.

= What if the Vefri handshake endpoint is not ready? =

The plugin keeps local API keys and webhooks, marks status as local-only, and continues plugin-side pushes once the API is available.

= What data leaves my site? =

When you Connect and when sync runs, the plugin sends store metadata and commerce data to your configured Vefri API endpoint. See **External services** below.

== External services ==

This plugin connects to the **Vefri** cloud API so merchants can manage orders, customers, and returns in the Vefri dashboard.

* **Service:** Vefri
* **Default endpoint:** `https://api.vefri.io` (merchants may set a different API base URL in the plugin settings)
* **Website:** https://vefri.io
* **Terms of Service:** https://vefri.io/terms
* **Privacy Policy:** https://vefri.io/privacy

**When data is sent**

* On **Connect / handshake** — registers the store with Vefri
* On **Disconnect** — notifies Vefri that the store is unlinking (when reachable)
* On WooCommerce **order** and **customer** create/update (webhooks / hooks)
* When a **return request** is created or its status changes in WordPress
* When Vefri updates a return decision (approve/reject), the plugin may receive a narrowly scoped write-back over HTTPS that updates only plugin return rows (no WordPress user login)

**Data that may be transmitted**

* Store URL, site name, WordPress/WooCommerce/plugin versions
* Store admin email (used for account/store association)
* WooCommerce REST API consumer key and secret created for this integration (used for standard WooCommerce REST order/customer access)
* Webhook / write-back signing secret (used for inbound webhooks and return-status write-backs)
* Order, customer, and return request fields needed for sync (for example order IDs, line items, customer name/email/phone, return reason and status)

No analytics or advertising trackers are bundled in this plugin. Sync only runs after you explicitly Connect (or when already connected and WooCommerce events fire).

== Changelog ==

= 1.0.1 =
* Return write-backs authenticate with the shared webhook secret over HTTPS headers only (no WordPress user impersonation, no secrets in query strings).
* Enqueue My Account returns script via wp_enqueue_script; remove load_plugin_textdomain for directory hosting.
* Limit WooCommerce-missing admin notice to relevant screens.

= 1.0.0 =
* Initial release: connect/disconnect, order & customer push, built-in returns module.
* Documentation for external Vefri API services and privacy links.
