=== CardV Gift Cards ===
Contributors: cardvnetservice
Tags: gift cards, digital goods, woocommerce, e-codes, vouchers
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Sell CardV digital gift cards in your WooCommerce store. Import products, keep prices in sync and deliver codes automatically after payment.

== Description ==

CardV Gift Cards connects your WooCommerce store to your CardV merchant account. You pick the gift cards you want to sell, the plugin creates the products, and when a customer pays, the codes are bought from CardV and delivered on the order page and in the order e-mail.

**What it does**

* Browse the CardV catalog from your WordPress admin and import products with one click.
* Fixed-value cards become one product with a choice of amounts. Cards with a custom amount get an amount field with live price preview.
* Prices follow your markup, for the whole store or per card, and never go below your minimum margin. If the cost rises, the plugin protects you from selling at a loss.
* Catalog, cost and stock are synced on a schedule you choose (default every 6 hours).
* After payment, codes are delivered automatically, or held for your review based on rules you set: payment method, order size, orders per customer and per IP, first-order limit and country checks.
* Codes are stored encrypted and shown only to the customer who bought them. Admin e-mails never contain codes.
* Sandbox mode for testing with no real money.

**What you need**

* A WooCommerce store.
* An approved CardV merchant account with API keys. Apply at [cardv.net](https://cardv.net/).
* A prepaid CardV balance. Orders are paid from this balance.

You are the seller of record to your customers. You set your prices, decide which orders are delivered automatically and handle your customers' support and refunds.

== External services ==

This plugin connects to the CardV Merchant API, operated by CardV, to work. It cannot function without it.

* **What it is used for:** reading your account and balance, reading the product catalog and prices, getting price quotes, placing gift card orders and reading their status and codes.
* **What is sent and when:**
  * When you test the connection, open the Products page, or the scheduled sync runs: your API key ID and signed request, plus catalog filters (no customer data).
  * When a paid order is fulfilled: the products, amounts and quantities, the expected unit price and an order reference made from your site and WooCommerce order number. No customer name, e-mail, address or payment data is sent.
  * When you open the Products page, import, sync or fulfil an order: price quotes for the cards involved.
  * On every sync, only if your store does not sell in USD: your store currency code, to read the exchange rate from USD. CardV checks its rates against several public sources; the plugin contacts no other service for it.
  * Every hour: your balance. Every few minutes while an order is waiting for its codes, and when a notification arrives: the order status, by CardV order number.
  * Every request carries the plugin, WordPress and WooCommerce version numbers (User-Agent) and comes from your server's IP address. The order reference contains a short hash of your site address and the WooCommerce order number.
  * While you browse CardV > Products, card logos are shown directly from CardV image hosts (`*.cardv.net`), so your browser loads those images from CardV. When you import a product, its image is copied once into your Media Library.
* **Incoming:** CardV may send signed order-status notifications to this site's REST endpoint `/wp-json/cardv-gift-cards/v1/webhook`. Requests that are not signed with your webhook secret are rejected.
* **Endpoints:** `https://b2b.cardv.net/api/v1/` (live) and `https://sandbox.cardv.net/api/v1/` (sandbox).
* **Service provider:** CardV, [https://cardv.net/](https://cardv.net/)
* **Terms of service:** [https://cardv.net/terms/](https://cardv.net/terms/)
* **Privacy policy:** [https://cardv.net/privacy/](https://cardv.net/privacy/)

== Installation ==

1. Install and activate WooCommerce.
2. Install this plugin from Plugins > Add New, or upload the zip, then activate it.
3. Open **CardV > Settings**, choose Sandbox, paste your API key ID, signing secret and webhook secret, and save. The plugin tests the connection.
4. Copy the webhook URL shown on the Settings page into your CardV Portal.
5. Open **CardV > Products**, select the cards you want to sell and import them.
6. Review your price and delivery rules, then switch to Live when you are ready.

== Frequently Asked Questions ==

= Do I need a CardV account? =

Yes. The plugin sells CardV products and pays for them from your CardV balance.

= What happens if my CardV balance is too low? =

Checkout for gift cards is paused until your balance covers the cart, so customers are not charged for cards you cannot deliver.

= Which orders are delivered automatically? =

Only orders paid with the payment methods you select, and that pass your delivery rules. Everything else waits on **CardV > Orders** for you to approve or reject.

= Can I change product titles, descriptions and images? =

Yes. The sync updates cost, price and availability only. It never overwrites your text.

= Can my theme change how the codes look? =

Yes. Copy any file from the plugin's `templates` folder to `yourtheme/cardv-gift-cards/` and edit it.

= Do I need to edit wp-config.php? =

No. Paste your keys on the Settings page; they are stored encrypted. Advanced users can instead define `CARDV_GC_LIVE_KEY_ID`, `CARDV_GC_LIVE_SIGNING_SECRET` and `CARDV_GC_LIVE_WEBHOOK_SECRET` (and the same names with `SANDBOX`) in `wp-config.php`; values set there override the Settings page. By default secrets and codes are encrypted with your WordPress salts. To use a separate key, define `CARDV_GC_ENCRYPTION_KEY` (at least 32 characters) before saving keys, and list old keys in `CARDV_GC_PREVIOUS_KEYS` (comma separated) when you change it.

= What is removed when I delete the plugin? =

Settings, encrypted secrets, scheduled jobs and the activity log are removed. Your products and orders stay in WooCommerce. Delivered codes stay encrypted on the orders.

== Screenshots ==

1. Overview with balance, products and orders that need you.
2. Import products from the CardV catalog.
3. Choosing an amount on the product page.
4. Gift card codes on the order page.
5. Price and delivery rules.

== Changelog ==

= 1.0.0 =
* First release.

== Upgrade Notice ==

= 1.0.0 =
First release.
