=== CatCode Barzahlen viacash for WooCommerce ===
Contributors: catcodestudio
Tags: barzahlen, viacash, cash payment, payment slip, woocommerce
Requires at least: 6.4
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

Let buyers pay in cash at the till of a partner store (Barzahlen / viacash): one payment slip with a barcode per order, settled by webhook.

== Description ==

Adds Barzahlen / viacash by viafintech as a payment method to WooCommerce. The buyer places the order, gets a payment slip with a barcode from viacash (by e-mail, and as a PDF in the viacash overlay on the thank-you page), and pays it in cash at the till of a partner store, for example a supermarket or a drugstore. viafintech tells the shop that the slip is paid, and the order moves to Processing. You use your own viafintech account (division ID and API key).

* **One slip per order** — the order total, the order number as reference and an expiry you choose (7 days by default). Placing the order twice gives the same slip; a slip request that timed out is repeated with the same Idempotency-Key, so it never makes two slips.
* **viacash checkout overlay** on the thank-you page and in "My account → Orders": the slip as PDF, the nearest partner stores, the slip sent to the phone. A button opens it again.
* **Nearest stores** — when the billing address is complete, the three closest partner stores are shown to the buyer.
* **Settled by webhook** — the call is checked with its BZ1-HMAC-SHA256 signature. A paid slip completes the order; a paid amount that differs from the order total puts the order on hold; an expired or invalidated slip cancels the order (the stock goes back); a declined slip fails it. Repeated webhooks change nothing.
* **Check the status** — a button on the order screen asks viafintech about the slip if the webhook did not arrive.
* **Check connection** — a signed call to viafintech with the division ID and the API key in the form.
* **Sandbox** — slips that cannot be paid in a store; payment and expiry are simulated in the viafintech App.
* Works with the classic and the block checkout, HPOS. The API key is stored encrypted. Currencies: EUR, CHF, BGN, CZK, HUF, PLN, RON, SEK, GBP, as enabled in your viafintech contract.
* Translations included: English, German.

= Pro =

The Pro version is sold on [catcode.com.ua](https://catcode.com.ua/modules/catcode-barzahlen-viacash-for-woocommerce/), with a 7-day trial that never starts by itself:

* **Refunds from WooCommerce** — a full or partial refund creates a viacash refund slip; the buyer collects the money in cash at a partner store. Its collection or expiry is noted on the order.
* **Reminders** — a set number of hours before the slip expires, viacash sends it to the buyer again.
* **Cancelled order, invalidated slip** — cancelling the order in WooCommerce invalidates its open slip, so it can no longer be paid.
* **Hourly re-check** of open slips not heard of for 6 hours (a missed webhook), and a "Re-check all open slips now" button.
* **Webhook journal** — the last 200 webhooks with their outcome.
* **Slip by text message** to the billing phone, and buttons on the order screen: send the slip again by e-mail or text message, invalidate it, create a new slip.
* **When the method is offered** — order total from/to, billing countries, customer groups (guests included).
* Updates from catcode.com.ua.

The licence runs for 1-5 years and includes updates and support for that term; a purchased licence keeps its Pro features after the term ends. One key covers two sites: the shop and its test copy.

Barzahlen and viacash are names of a payment product of viafintech GmbH. This plugin is an independent integration made by CatCode; it is not an official plugin of viafintech and is not affiliated with or endorsed by it. You need your own viafintech account; live payments need a contract with viafintech.

== External services ==

The plugin connects to the viafintech API v2 (viafintech GmbH, Berlin, [viafintech.com](https://www.viafintech.com/), documentation at [docs.viafintech.com](https://docs.viafintech.com/api/v2/)) at `api.viafintech.com`, or `api-sandbox.viafintech.com` in sandbox mode, and only after you enter your division ID and API key. Every request is signed with the API key; the key itself is never sent.

* When you press "Check connection": a signed empty request (`/ping`).
* When the buyer places an order with this method: the amount and currency, the order number as reference, the expiry date, the buyer's e-mail address, the buyer identifier (the e-mail address or a customer number, as set), the language, the order ID and order key as metadata, the shop's webhook address, and the billing street, postcode, city and country (to find nearby stores, only when all four are filled in).
* With the text message option on (Pro): the billing phone number.
* When a webhook arrives it carries the slip; when you press "Check the status": the slip ID, to read the slip.
* Pro: the slip ID to send the slip again or to invalidate it, and for a refund the paid slip ID and the amount.

On the thank-you and order pages the buyer's browser loads the viacash checkout script from `cdn.viafintech.com` (viafintech requires that it is not hosted elsewhere) with the checkout token of the slip. viacash sends the slip to the buyer by e-mail itself.

[viafintech legal notice](https://www.viafintech.com/en/legal/) · [Privacy notice (Paysafe group, viafintech's parent)](https://www.paysafe.com/privacy/120126_Comprehensive_Privacy_Notice_EN.pdf)

== Installation ==

1. Upload the plugin and activate it. WooCommerce must be active, the shop currency one that viafintech takes for your division (usually EUR).
2. In the viafintech App open Settings / Divisions and copy the division ID and the API key. In WooCommerce → **Barzahlen** paste them, leave "Sandbox" on for the first tests, press "Check connection" and save.
3. The webhook address is sent with every slip when the site runs on https. Without https, or if you turn that off, enter the address shown on the plugin screen in the viafintech App under Settings / Divisions / Notification URL.
4. WooCommerce → Settings → Payments: enable "Barzahlen / viacash". Place a test order and simulate the payment in the viafintech App.
5. For live payments switch the sandbox off and use the live division ID and API key.

== Frequently Asked Questions ==

= Do I need a viafintech account? =

Yes. The sandbox is available right after sign-up; live payments need a contract with viafintech. The plugin does not do the sign-up.

= Why is the order "on hold" after checkout? =

It waits for the cash payment. It moves to Processing when viafintech reports the slip paid. viafintech sends the "paid" webhook after the store's cooldown period, so it can come some minutes after the buyer paid.

= What happens when the buyer does not pay? =

The slip expires after the days you set, viafintech reports it, and the order is cancelled with its stock put back.

= Can I show the barcode number myself? =

viafintech returns the barcode number only when it enables that for your division. The plugin uses the viacash overlay and the e-mail from viacash, which work without it.

== Changelog ==

= 1.0.1 =
* Fixed the licence status shown after the trial, with the link to buy a licence.

= 1.0.0 =
* First release.
