=== VayaPin Connector ===
Contributors: vayapin
Tags: woocommerce, checkout, address, autofill, vayapin
Requires at least: 6.0
Tested up to: 7.1
Stable tag: 2.4.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

VayaPin Checkout Autofill for WooCommerce: one-click address autofill with GPS-precise VayaPin codes. Free plugin; API token from VayaPin. Starter plan includes 50 conversions/month, no credit card.

== Description ==

**Product:** VayaPin Checkout Autofill for WooCommerce (this package: **VayaPin Connector**).

**Stop losing sales at checkout. Stop losing money on failed deliveries.**

41% of customers abandon their cart when address entry is difficult. 39% of deliveries fail due to inaccurate addresses. VayaPin Checkout Autofill helps merchants close the gap: customers enter a short code (e.g. MARIA86) and billing/shipping fields can fill via the VayaPin API.

**WooCommerce:** requires 3.0 or higher; tested through 11.x in marketplace QA. **WordPress:** 6.0+, tested up to 7.1.

**What VayaPin is**

A GPS-precision digital address: a human-readable code mapped to a location, coordinates, entrance photos, and delivery instructions where the profile includes them.

**How it works**

1. Install and configure under WooCommerce / VayaPin admin — classic checkout and WooCommerce Blocks.
2. Customer with a VayaPin enters the code for autofill; without a code they checkout normally and can opt in to create a VayaPin (e.g. “Create my VayaPin for faster checkout everywhere”).
3. Orders can store GPS, instructions, and photos where provided; QR delivery labels for partners where enabled.
4. Customers who create a VayaPin via your store can treat it as a “Favourite Pin” for your brand (VayaPin product behaviour).

**VayaConnect: ask a customer for their address**

Autofill works when a shopper already has a VayaPin. VayaConnect covers the other direction. You pick a customer and ask for their address; VayaPin emails them a link; they drop a single pin on a map in their own language; the verified address comes back to your store on its own.

Nobody types an address in a script they cannot read. A customer in Tokyo or Prague writes their address the way they write it, and you receive it in the local script and in Latin, with the GPS point the driver actually needs. Orders with a verified address can be printed as a dual-script delivery label.

Find it under **Vayapin → Settings → Partners**. It lists your WooCommerce customers with where each one stands (no VayaPin, request pending, has one), and anyone who has never ordered from you can be added by hand. It is switched off until you enable it and save the signing secret VayaPin gives you for your store's inbound webhook.

**Why merchants use it**

* Less checkout friction, especially on mobile.
* Coordinates and entrance context, not only street text.
* Customer data can stay current when they update their VayaPin.

**Plugin features**

* VayaPin autofill field — position and light or dark theme.
* API lookup — name, address, phone, email, city, postcode, country, GPS (per API response).
* Consent checkbox at checkout for new VayaPin creation; wording fixed and versioned by VayaPin, never pre-ticked.
* VayaConnect — request an address from any customer and receive a verified, multi-script pin back.
* Order meta for delivery/GPS; QR labels; delivery metabox on orders.
* Analytics in admin where implemented.
* Classic + Blocks checkout; HPOS compatible; hooks/filters; responsive; consent-oriented flows.

**Pricing**

Plugin download is free. API token from [vayapin.com/developers](https://vayapin.com/developers). **Starter:** 50 conversions/month, free, no credit card. **Paid tiers** (Business, Professional, Scale, Enterprise) — see [vayapin.com/pricing](https://vayapin.com/pricing). Paid SaaS plans include a 30-day money-back guarantee per VayaPin terms.

**Extended copy** (comparison table, stats, full FAQ): see `README.md` in this repository.

== External services ==

This plugin uses the **VayaPin API** during checkout and admin flows.

* Service: VayaPin API
* Endpoint (example): [https://cs.vayapin.com](https://cs.vayapin.com)
* Terms: [VayaPin Terms of Use](https://vayapin.com/terms-of-use)
* Privacy: [VayaPin Privacy Policy](https://vayapin.com/privacy-policy)

Only send data required for API auth and lookups you enable. Use a valid token; disclose flows in your privacy policy.

== Installation ==

1. Upload `vayapin` to `/wp-content/plugins/` or install from a package.
2. Activate under **Plugins**.
3. Install **WooCommerce** (3.0+; validate against your version).
4. Open **VayaPin** / **WooCommerce → VayaPin**, set API key and environment, save.
5. Configure widget position and theme, webhooks, delivery options, and VayaConnect if you want it.

API token: [vayapin.com/developers](https://vayapin.com/developers)

== Frequently Asked Questions ==

= Is the free plan completely free — no credit card required? =

Yes. Starter includes 50 conversions/month at no cost, no credit card. All plugin features on Starter per current VayaPin plan rules.

= Will this slow down my store? =

Assets load on checkout with minimal footprint; marketplace positioning references Core Web Vitals. Profile your site with your theme and other plugins.

= What happens when a customer doesn't have a VayaPin? =

They use a normal address. Optional checkbox can offer VayaPin creation; they receive a code by email for future stores.

= How is VayaConnect different from autofill? =

Autofill is the customer giving you a VayaPin they already have. VayaConnect is you asking someone who has none. They get an email, drop one pin on a map, and the verified address returns to your store by itself. You never type a foreign address, and the courier gets coordinates rather than a transliteration.

= Does a customer need an account to answer a VayaConnect request? =

No. They open the link, drop a pin and confirm. A VayaPin is created for them in the process, which they can then use at any other store.

= What does a VayaConnect request send about my order? =

Nothing about the order. The request carries the recipient's name, email and country, plus a phone number and rough address when you already have them. No products, no totals, no order number.

= Why is the partner list locked? =

VayaConnect needs a signing secret before it will accept replies. Paste the one VayaPin generated for your store's inbound webhook under Partners, save, and the list unlocks. A request you cannot receive an answer to is not worth sending.

= Does this work with my theme and checkout setup? =

Compatible with major WooCommerce themes, classic checkout, and Blocks. Hooks/filters for customization; heavy custom checkout may need support.

= Is customer data secure and GDPR compliant? =

Encrypted connections; explicit checkout consent for VayaPin data. You remain responsible for legal basis and notices.

= What if a customer moves or changes contact details? =

Updated VayaPin data applies on their next lookup/order.

= Do my customers need the VayaPin Chrome extension? =

No. Checkout uses the field + API. The Chrome extension is a separate product.

= What data does my store receive per order? =

Name, address, phone, email, city, postcode, country, GPS, entrance type, delivery instructions — as returned by the API.

= What happens if I exceed my monthly conversion limit? =

Alerts at 80% and 100%; overages may apply — [vayapin.com/pricing](https://vayapin.com/pricing).

= Can I use this on multiple WooCommerce sites? =

Yes. Each site should use its own API token; limits are per token.

= What payment gateways does VayaPin work with? =

All major WooCommerce gateways; VayaPin only handles address autofill.

= Do you offer refunds? =

30-day money-back on paid SaaS per VayaPin policy (support@vayapin.com). The plugin file is free.

= Where is documentation and support? =

* [docs.vayapin.com](https://docs.vayapin.com)
* [support.vayapin.com](https://support.vayapin.com)
* [vayapin.com/feature-requests](https://vayapin.com/feature-requests)

== Screenshots ==

1. The ultimate digital address — GPS coordinates, image/video guidance, gate codes, delivery notes, and universal map support for flawless first-attempt deliveries.
2. Next-level checkout and flawless deliveries — one-click autofill via VayaPin alias boosts conversions and eliminates failed drop-offs with GPS-powered delivery.
3. Lightning-fast 1-click checkout — shoppers enter their VayaPin alias to instantly autofill all billing and shipping fields, reducing cart abandonment.
4. Native QR code delivery labels — auto-generated scannable labels on packing slips let any courier navigate to the exact drop-off point without a special app.
5. Track conversions and build trust — monitor VayaPin checkout usage from your WordPress dashboard and display customizable "VayaPin Accepted" trust badges.

== Changelog ==

= 2.4.0 =
* New: the autofill widget is one small pill above the address fields. Clicking it opens a single inline row with the country, the Pin name and a GO button, and once an address is filled the row becomes one line naming the Pin, with a link back to change it. The pop-up panel and the separate phone layout are gone.
* New: a Light or Dark theme setting, so the widget can sit on a dark checkout.
* Change: the widget's headline, placeholder and button label are no longer editable, and neither are its colours or corner radius. The wording and the look are fixed.
* Change: the widget position now offers above the shipping address, above the billing address, or above both. Shops set to "below billing" are read as "above billing", and the custom hook placement is read as "above shipping". The vayapin_widget_position hook has been removed.
* Change: the checkout consent box is always shown, never pre-ticked, and its wording is fixed by VayaPin. The settings that switched it on, pre-ticked it and edited its text are gone. It appears only while a valid API key is saved, and it now sits after the address fields rather than inside the billing column.
* Fix: ticking the consent box no longer makes a phone number mandatory. A phone is sent only when the shopper entered one.
* Fix: pressing Enter in the Pin field now does what GO does. It was being swallowed, and without that guard it would have submitted the checkout.
* Fix: a failed lookup no longer leaves its message on screen once the Pin name is edited.
* Change: the bundled select2 library and a search-as-you-type lookup path that no markup could reach have been removed. The plugin downloads about 86 KB lighter.
* New: VayaConnect ships with this release. A Partners tab lists your WooCommerce customers with their VayaPin status and lets you ask anyone without one for their address. It stays switched off until you enable it and save a webhook secret.
* New: the country in the Pin field starts on your shop's own country instead of a fixed one. A shopper who picked a country here before still gets their own choice back.
* Fix: the consent box could not be ticked at all, the country list would not close on a second tap, and the first click after opening that list did nothing. One stray listener left behind by the country dropdown was cancelling clicks across the whole page.
* Fix: the country list opened a few pixels wide and the flag sat outside the field on narrow screens. The list now opens at the width of the field and the row stays on one line down to small phones.
* Fix: searching the country list no longer closes it, and a search that matches nothing now says so.
* Fix: the Pin row no longer stretches out of shape on storefronts whose theme sets its own widths on inputs and buttons.
* Change: the separate information banner at checkout has been removed along with its setting. What it said is now in the line under the consent box and in the panel behind the question mark.

= 2.3.4 =
* Fix: with the widget set to sit above the shipping address form it was not shown at all. It was being placed inside the shipping block, which the checkout keeps collapsed until the customer chooses to ship elsewhere, and which is left out entirely when an order needs no delivery address. The widget now sits above that block and stays visible either way.
* Fix: the order button could swallow the first click right after an address was filled in. The checkout briefly covers the payment area while it recalculates, and a click landing there did nothing and said nothing. The button is now visibly held during that moment, and the recalculation is run once instead of once per filled field.

= 2.3.3 =
* Fix: orders were not placed after autofill in countries where WooCommerce uses a fixed region list. VayaPin returns the region by name and WooCommerce validates its code, so the form looked complete while the order was rejected. Region names are now resolved to the code, and postcodes are formatted the way the country expects.
* Fix: the "Save my address" opt-in stayed selected after autofill hid it, so checkout asked for a phone number against a checkbox the customer could no longer see.
* Fix: the VayaPin block on the order screen ignored the QR Delivery Sticker toggle and stayed visible after it was switched off.
* Fix: the delivery label always printed at its default size, whatever was chosen under Sticker Size. The order label and the sample now both follow the setting.
* Fix: the sample label button saved an HTML page under a .pdf name, so the downloaded file would not open. It now opens the sample ready to print and is labelled accordingly.
* Fix: label addresses returned "not found" after activation until the permalinks were saved by hand.
* Security: order label pages are now limited to users who can edit the order. Previously anyone with the link could read the customer's pin.
* Change: diagnostic log lines are only written when WP_DEBUG is switched on, so order ids and pin names no longer collect in a production log.

= 2.3.2 =
* Change: the mobile sheet takes the widget's own background colour instead of white, so the panel and the pin field read as one surface. The colour follows the merchant's accent setting.
* Fix: the sheet's back arrow disappeared under storefront button styling (themes match plain buttons through [type=button], which ties on specificity and loads last). The sheet's own controls are now insulated from it.

= 2.3.1 =
* Fix: inside the mobile sheet the pin row lost its styling (oversized GO button, collapsed input) because the widget styles hang off a class that stayed behind on the original container. The row now matches the desktop layout exactly.
* Fix: the sheet's back button and search field no longer inherit storefront button and input styling.

= 2.3.0 =
* New: on phones the whole widget flow opens in a bottom sheet: pin entry, country picking with search and full-size rows, drag or flick down to dismiss. Desktop keeps the existing popup.
* Fix: the widget scripts relied on jQuery's removed `.load()` shortcut and only ran on sites that still load jQuery Migrate.

= 2.2.9 =
* Fix: typing and backspace were blocked in the VayaPin field after the country list had been opened. The list was hidden by class only, which left the country plugin's key handler bound and it cancelled every key press.
* Fix: the "Not found. Please enter a valid VayaPin." message stayed on screen after closing the popup. It is cleared on close, on reopen, and as soon as the code is edited.

= 2.2.8 =
* Fix: checkout autofill left "Street address" and "Apartment" empty for pins that store the street number or the building name in separate fields (JP pins among them). The street line is now built from road + house number, the second line from building name + addition.
* Fix: city and state fall back to their "_part" counterparts when the primary field is empty.

= 2.2.7 =
* Fix: checkout autofill now clears the "required field" validation errors on the fields it fills, instead of leaving them red until the field is touched manually.
* Fix: new VayaPin creation sent only the last name in the `name` field, which the API rejected with HTTP 422 ("name: must include a last name"). Full first + last name is sent now, per the /v1/pins contract.
* Fix: API validation errors were logged with an empty message, so a failed pin creation showed a bare HTTP_422 with no reason. The error code, message and per-field errors are parsed and stored now.
* Change: Pin Creation History CSV export includes the raw API response for failed attempts.

= 2.2.0 =
* New: VayaConnect — request a VayaPin address from any customer. Adds a Partners tab listing WooCommerce customers with their VayaPin status (verified / pending / none) and a "Request VayaPin address" button.
* New: inbound `pin.address_updated` webhook receiver (REST: /wp-json/vayapin/v1/webhooks) with HMAC-SHA256 verification and replay idempotency. The verified record (VayaPin ID, every script, GPS, QR) is written back to the customer/order automatically.
* New: VayaConnect record surface on the order detail screen and customer profile.
* New: carrier-ready international label (dual-script + QR) at /vayapin-intl-label/{order_id}.
* New: VayaConnect on/off toggle (off by default). The outbound request verb is behind a single contract seam pending the VayaCore backend.

= 2.1.1 =
* Fix: VayaPin widget no longer breaks the WooCommerce checkout form (nested form removed; Place order works again).
* Fix: country dropdown no longer clipped by the popup; anchored below the input and widened.
* Fix: country list now closes when clicking inside the popup.
* Fix: mobile layout — flag positioning, input padding, and full-width GO button.
* Fix: selecting a country on mobile no longer closes the popup.
* Change: Changelog link in settings footer now points to the WordPress.org plugin page.

= 2.0.0 =
* Settings UI refresh, checkout/delivery, webhooks, logging, compatibility. Readme aligned with WooCommerce marketplace listing and API disclosure.

= 1.0.0 =
* Initial public structure for the VayaPin Connector plugin.

== Upgrade Notice ==

= 2.4.0 =
The widget's texts, colours and radius are no longer editable and the position options have changed; saved values are mapped to the nearest one. The vayapin_widget_position hook is gone. Re-check the checkout after updating.

= 2.3.4 =
Fixes the widget disappearing on one of the position settings, and an order button that could ignore the first click after autofill.

= 2.3.3 =
Fixes checkout submission after autofill and restricts order label pages to store staff. Re-test placing an order on staging after updating.

= 2.3.2 =
Mobile sheet visual fixes: single tinted surface and a visible back arrow.

= 2.3.1 =
Fixes the pin row layout inside the mobile sheet.

= 2.3.0 =
Adds the mobile bottom sheet and fixes empty street fields after autofill. Test the checkout widget on a phone after updating.

= 2.2.9 =
Fixes the VayaPin input becoming uneditable after opening the country list, and the stale "Not found" message.

= 2.2.8 =
Fixes empty street address fields after autofill for pins with a separate house number or building name.

= 2.2.7 =
Fixes checkout validation errors sticking after autofill and VayaPin creation failing with HTTP 422. Recommended for all stores.

= 2.2.0 =
Adds VayaConnect (Partners tab + inbound address webhook). Disabled by default — enable it under the Partners tab and set a webhook secret. Re-save permalinks if the international label URL 404s.

= 2.1.1 =
Checkout reliability fixes (Place order, country dropdown, mobile). Recommended for all stores. Test checkout on staging after update.

= 2.0.0 =
Major update: review settings, re-save if needed, test checkout on staging.
