=== ChargeDeck ===
Contributors: chargedeck
Tags: payments, payment gateway, checkout, ecommerce, credit card
Requires at least: 5.8
Tested up to: 6.7
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Take payments through your own ChargeDeck checkout: a WooCommerce payment method plus a block and shortcode to embed checkout anywhere.

== Description ==

ChargeDeck lets your WordPress site accept payments through a ChargeDeck hosted checkout. It is **non-custodial**: money settles directly in your own connected processor (Stripe, Square or PayPal). ChargeDeck never holds your funds.

There are two ways to use it:

* **WooCommerce payment method.** Customers choose "ChargeDeck" at checkout, pay on your secure ChargeDeck page, and are returned to your order-confirmation page automatically. Paid orders are confirmed by a cryptographically signed webhook (with a return-page fallback), so status stays reliable even if the customer closes the tab.
* **Embed anywhere.** Drop a "ChargeDeck Checkout" block onto any page, or use the `[chargedeck]` shortcode, to add a Pay/Buy button that opens a ChargeDeck checkout. WooCommerce is not required for this.

= Shortcode examples =

    [chargedeck link="https://chargedeck.app/l/XXXX" text="Buy now"]
    [chargedeck slug="my-checkout-slug" text="Pay"]
    [chargedeck amount="24.00" currency="gbp" description="Coffee subscription" text="Subscribe"]

`amount` is in your currency (for example 24.00) and auto-creates a reusable ChargeDeck payment link. Supported currencies: GBP, USD, EUR, CAD, AUD.

= Requirements =

You need a ChargeDeck account (chargedeck.app) with a payout processor connected. The plugin uses your ChargeDeck API key and webhook secret, entered under Settings, ChargeDeck.

== External services ==

This plugin connects to **ChargeDeck** (https://chargedeck.app), the payment platform it integrates with. This connection is required for the plugin to work, because it is a payment integration.

What is sent, and when:

* **At WooCommerce checkout**, when a customer chooses ChargeDeck, the plugin sends the order details to the ChargeDeck API (`https://chargedeck.app/api/v1/checkouts`): the amount, currency, an order reference (your order ID), a description, the customer's email address, line item names, quantities and per-item amounts, and your success and cancel return URLs. ChargeDeck returns a hosted checkout URL and the customer is redirected there to pay.
* **When a `[chargedeck amount="..."]` button is rendered**, the plugin sends the amount, currency and description to `https://chargedeck.app/api/v1/payment-links` to create a reusable payment link (the result is cached).
* **To confirm a paid order**, ChargeDeck sends a signed webhook back to your site (verified with your webhook secret).
* **When you click "Test connection"** in settings, the plugin makes an authenticated request to the ChargeDeck API to confirm your key.

Data is only sent to the ChargeDeck URL you configure (https://chargedeck.app by default). No data is sent anywhere else.

Your use of ChargeDeck is subject to its terms and privacy policy:

* Terms of Service: https://chargedeck.app/terms
* Privacy Policy: https://chargedeck.app/privacy

== Installation ==

1. Upload the plugin ZIP via Plugins, Add New, Upload Plugin, then Activate. (Or upload the `chargedeck` folder to `/wp-content/plugins/`.)
2. Go to Settings, ChargeDeck and enter your **API key** and **Webhook signing secret** from your ChargeDeck dashboard (Developer). Click **Test connection**.
3. Copy the **webhook URL** shown there and paste it into ChargeDeck (Developer, Webhook URL).
4. For WooCommerce: go to WooCommerce, Settings, Payments and enable **ChargeDeck**.

== Frequently Asked Questions ==

= Is it non-custodial? =

Yes. Payments are processed by your own connected Stripe, Square or PayPal account inside ChargeDeck. Funds never pass through this plugin.

= What happens if the customer closes the tab after paying? =

ChargeDeck sends a cryptographically signed webhook to your site to confirm the order independently of the browser. Signatures are HMAC-SHA256 and verified against your webhook secret; stale, replayed and forged events are rejected. There is also a fallback check when the customer returns to the order page.

= Does my store currency have to match? =

Your WooCommerce currency must be one ChargeDeck supports (GBP, USD, EUR, CAD, AUD) and must match the currency your ChargeDeck processor settles in. If not, the ChargeDeck method is hidden at checkout.

= Do I need WooCommerce? =

No. The block and shortcode work on any WordPress site. WooCommerce is only needed for the checkout payment method.

= How are refunds handled? =

Refunds are made in your connected processor (Stripe, Square or PayPal). This version does not push refunds from WooCommerce back to the processor.

== Screenshots ==

1. Settings, ChargeDeck: connect your account with your API key and webhook secret, and copy your webhook URL.
2. ChargeDeck shown as a payment method at WooCommerce checkout.
3. The "ChargeDeck Checkout" block, for embedding a pay button on any page.

== Changelog ==

= 1.0.0 =
* Initial release: WooCommerce payment gateway, signed webhook confirmation with a return-page fallback, and the [chargedeck] embed block and shortcode.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
