=== CatCode Payments with CM.com for WooCommerce ===
Contributors: catcodestudio
Tags: cm.com, ideal, wero, bancontact, payment gateway
Requires at least: 6.4
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

CM.com Online Payments for WooCommerce: iDEAL | Wero, cards, Bancontact and the other methods of your CM.com account on the hosted checkout.

== Description ==

Adds CM.com Online Payments as a payment method to WooCommerce. The customer chooses it at the checkout, is sent to the hosted CM.com Checkout, pays there with one of the payment methods of your CM.com account (iDEAL | Wero, cards, Bancontact, Apple Pay, Google Pay and others) and comes back to your shop. The plugin uses the current CM.com Online Payments API (OAuth 2.0 client credentials) with your own CM.com merchant account.

* **Hosted CM.com Checkout** — a checkout transaction per order with the amount, the currency, the order number, the customer's name, e-mail, phone and billing address (when they are complete), the language of your shop and the return addresses for a successful, cancelled, expired and failed payment.
* **Confirmed by CM.com, not by the redirect** — every checkout carries its own webhook address of your shop. The webhook is only a trigger: the plugin then asks CM.com for the transaction and compares the paid amount and currency with the order before it marks the order paid. The same check runs when the customer comes back to the thank-you page or to the checkout.
* **Plain results** — a cancelled or expired payment cancels the waiting order and the cart stays, a failed one fails it, an authorized payment puts the order on hold until CM.com confirms it. The customer sees a short message on the checkout. A second paid checkout of the same order and a chargeback are written in the order notes.
* **Check status at CM.com** — a button on the order screen asks CM.com about the transaction.
* "Check connection" tests the client ID and the client secret without creating anything. Test and production environment, an order number prefix for several shops on one account.
* Works with the classic and the block checkout, HPOS. The client secret is stored encrypted.
* Translations included: English, Dutch.

= Pro =

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

* **Separate payment methods at the checkout** — iDEAL | Wero, cards, Bancontact, Apple Pay, Google Pay, Klarna and in3, each its own method that opens the CM.com page with only that payment method. Switch each on and set its title, description and place in WooCommerce → Settings → Payments.
* **Klarna and in3** — sent with the order lines (products, shipping, fees, VAT) that add up to the order total exactly; in3 from 50 euros, with an optional date of birth field at the checkout (classic and block).
* **Methods on the CM.com page** — choose which payment methods the main CM.com method offers.
* **Refunds from WooCommerce** — a full or partial refund becomes a refund at CM.com; when CM.com reports a refund as paid out, failed or cancelled, it is written in the order notes.
* **Payment time** — how long the customer has to pay (5 to 60 minutes); an expired checkout cancels the order.
* **Background check** — every hour, CM.com is asked about payments whose webhook did not arrive.
* **Journal** — the last calls to CM.com and webhooks, with their results.
* 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.

CM.com is a trademark of its owner. This plugin is an independent integration made by CatCode; it is not an official plugin of CM.com and is not affiliated with or endorsed by it. You need your own CM.com Online Payments merchant account with API credentials.

== External services ==

The plugin connects to the CM.com Online Payments API (CM.com, [cm.com](https://www.cm.com/), documentation at [docs.cm.com](https://docs.cm.com/payments/online-payments)) at `pay-acceptance.cm.com` (test) or `api.pay.cm.com` (production), and only after you enter your client ID and client secret. Every request first gets an access token with the client ID and the client secret.

* When the customer chooses CM.com at the checkout: the order total and currency, the order number and a short description with the shop name, the language of the shop, the return addresses and the webhook address of the shop, and — when they are complete — the customer's first and last name, e-mail address, phone number and billing address. The customer is then sent to the CM.com payment page (for example `checkout.cmpayments.com`), where CM.com collects the payment details.
* When a webhook comes in, when the customer comes back to the shop, when you press "Check status at CM.com": the transaction ID.
* When you press "Check connection": the client ID and the client secret, to get a token.
* Pro: for Klarna and in3 the order lines (product code, name, quantity, price, VAT) and, when the customer enters it, the date of birth; the transaction ID, the amount and your reason of a refund; the transaction ID to read its refunds; every hour the transaction IDs of payments still waiting.

[CM.com privacy statement](https://www.cm.com/app/legal/miscellaneous/privacy-statement/) · [CM.com terms and conditions](https://www.cm.com/app/legal/cmcom-terms-and-conditions/)

== Installation ==

1. Upload the plugin and activate it. WooCommerce must be active.
2. In WooCommerce → **CM.com** choose the environment, enter your client ID and client secret, press "Check connection" and save.
3. WooCommerce → Settings → Payments: enable "CM.com Payments". Place a test order in the test environment with a CM.com test card.

== Frequently Asked Questions ==

= Do I need a CM.com account? =

Yes, a CM.com Online Payments merchant account. CM.com support sets up an account on its test environment with API credentials for it, and later the production account.

= Do I have to register a webhook at CM.com? =

No. Every checkout transaction carries its own webhook address of your shop. The site must be reachable from the internet for the webhooks to arrive; without them the status is still read when the customer comes back and when you press "Check status at CM.com".

= Why is the order "pending payment" after the customer left for CM.com? =

It waits for the customer to finish the payment. It becomes "processing" when CM.com reports the payment as successful; a cancelled or expired payment cancels it.

= Which payment methods are shown on the CM.com page? =

The ones active in your CM.com account (CM.com support configures them). Klarna and in3 need the order lines and are not shown by the main method of the free version.

== Changelog ==

= 1.0.0 =
* First release.
