# WooCommerce plugin

> Add Anytime Capital Payments to WooCommerce: install the plugin, connect your API key and a signed webhook, and take card payments with refunds from orders.

Source: https://anytime-capital.com/docs/woocommerce · Markdown: https://anytime-capital.com/docs/woocommerce.md · All docs: https://anytime-capital.com/docs/llms-full.txt

The Anytime Capital Payments plugin adds card payments to WooCommerce. At checkout the order total becomes a one-time payment link, the customer pays on Anytime Capital's secure checkout, and a signed webhook marks the order paid. It works with the classic checkout and the Cart and Checkout blocks, and with WooCommerce's order storage (HPOS).

- [Download the plugin](https://anytime-capital.com/api/integrations/woocommerce/download): anytime-capital-payments.zip, ready for Plugins → Add New → Upload Plugin.

## Requirements

- WordPress 6.2 or later, WooCommerce 8.0 or later, PHP 7.4 or later.
- Your store's currency set to US dollars. The method doesn't show for other currencies.
- Orders from $1.00 to $10,000.00.
- An Anytime Capital business account with card payments switched on.
- Your store served over https, so customers return to your order confirmation after paying.

## Set it up

1. In WordPress, go to **Plugins → Add New → Upload Plugin**, upload `anytime-capital-payments.zip` and activate it.
2. In your Anytime Capital dashboard, open **Settings → Developers** and create an API key. Copy it (`ak_live_…`).
3. Still in **Settings → Developers**, add a webhook endpoint for `https://your-store.example/wp-json/anytime-capital/v1/webhook` (the plugin settings show your exact URL) with the events `payment.succeeded`, `payment.failed` and `payment.refunded`. Copy its signing secret (`whsec_…`).
4. In WordPress, go to **WooCommerce → Settings → Payments → Anytime Capital Payments**. Paste the API key and the signing secret, check the title and description customers see, and enable it.
5. Check the whole flow in test mode first (below), then place a small real order and refund it from the order screen.

## Test mode

1. In your Anytime Capital dashboard, turn on **Test mode** in the header. In **Settings → Developers**, create a test key (`ak_test_…`) and a webhook endpoint for the same URL and events, and copy its signing secret.
2. In the plugin settings, tick **Test mode** and paste the test key and the test signing secret. Your live key and secret stay saved.
3. Place an order and pay with a [test card](https://anytime-capital.com/docs/test-mode.md#test-cards). No real money moves; the order's notes say it was a test.
4. Untick **Test mode** to take real payments with your live key.

A live key never works in test mode and a test key never works in live mode: the method is hidden at checkout until the key matches. A test webhook only ever changes test orders and a live one only live orders, so a live order still pending when you switch is completed as usual. Refund a test order with Test mode on.

## How an order is paid

1. The customer chooses the method and places the order; it waits as **Pending payment**.
2. The plugin creates a one-time payment link for the order total, with the order id, order key and your site in its `metadata`, and your order confirmation page as its `successUrl`.
3. The customer pays on Anytime Capital's checkout and returns to your store.
4. We send `payment.succeeded` to your webhook. The plugin checks the `Anytime-Signature` header (HMAC-SHA256 with your signing secret, at most 5 minutes old, compared in constant time), matches the order by id and key, checks the amount, and marks it paid with the payment's id as the transaction id.

The order is marked paid only by the webhook, never by the customer reaching the confirmation page, and only once however many times the event arrives. A declined card marks a pending order **Failed**; the customer can still pay on the same link, and a later success completes the order.

## Refunds

- Refund from the order screen with **Refund via Anytime Capital Payments**, in full or in part.
- If your business requires an owner's approval for refunds over a limit, the refund waits for that approval and is added to the order once it's sent.
- Refunds made in your Anytime Capital dashboard are added to the order by the `payment.refunded` webhook, up to the payment's refunded total, so nothing is counted twice.

## Good to know

- Your store calculates tax and shipping and we charge the order total. If you collect sales tax in Anytime Capital, turn it off for your store's payments so customers aren't taxed twice.
- One Anytime Capital business can serve several stores: each store only acts on its own orders.
- Deleting the plugin removes its settings, including your API key and signing secret. Order notes and transaction ids stay on your orders.
- Turn on **Debug log** in the plugin settings to see each step under **WooCommerce → Status → Logs**. Keys and secrets are never logged.

- [Webhooks](https://anytime-capital.com/docs/webhooks.md): Events, retries and signature verification.
- [Payment links API](https://anytime-capital.com/docs/payment-links.md): The payment links the plugin creates.
- [Authentication](https://anytime-capital.com/docs/authentication.md): API keys and how to keep them safe.

---

Anytime Capital is a fintech company, not a bank. Payment processing, banking and payout services are provided by Anytime Capital's licensed partners. Rates shown are for US card payments; international cards, currency conversion and disputes may carry additional fees shown in your dashboard before you accept a payment.
