> For the complete documentation index, see [llms.txt](https://help.getlfg.app/p/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.getlfg.app/p/developers/woocommerce.md).

# WooCommerce plugin

Accept USDC on Base in your WooCommerce store with the Layer Flow Gateway plugin — install, connect your API key, and orders update themselves.

The **Layer Flow Gateway Payments for WooCommerce** plugin adds a **Pay by Layer Flow Gateway** option to your checkout. Buyers are sent to the Layer Flow Gateway hosted checkout, pay in USDC on Base, and come straight back to your store. The order is marked paid automatically — no code required.

It's built on the [Pay API](/p/developers/pay-api-integration-guide.md), so everything in that guide applies under the hood.

## Requirements

* WordPress 6.5+ and WooCommerce 8.3+ (PHP 7.4+).
* A Layer Flow Gateway business account on a **monthly plan** — API keys aren't available on pay-as-you-go or the trial. Only the business **owner** can create keys.
* Your store currency set to **US Dollar (USD)**. The payment method stays hidden for other currencies.

## 1. Install the plugin

1. Download the plugin: [layer-flow-gateway-woocommerce.zip](https://lfg-plugins.s3.eu-central-1.amazonaws.com/layer-flow-gateway-woocommerce.zip). Don't unzip it — WordPress installs the zip as-is.
2. In WordPress, go to **Plugins → Add New → Upload Plugin**, choose the zip, and click **Install Now**, then **Activate**.

## 2. Create an API key

1. In the Layer Flow Gateway dashboard, open **Settings → API Keys** and click **Create key**. Name it after your store (for example, "WooCommerce").
2. Copy both values shown — the **API key** (`lfg_sk_live_…`) and the **webhook signing secret** (`whsec_…`). Each is shown **once**.

You don't need to enter a webhook URL on the key: the plugin sends its own with every payment.

## 3. Connect WooCommerce

Go to **WooCommerce → Settings → Payments → Layer Flow Gateway Payments** and fill in:

| Setting                | What to enter                                                                                                  |
| ---------------------- | -------------------------------------------------------------------------------------------------------------- |
| Enable                 | Tick it.                                                                                                       |
| API key                | The `lfg_sk_live_…` key.                                                                                       |
| Webhook signing secret | The `whsec_…` secret.                                                                                          |
| Test mode              | Tick it to take test payments in USDC on Base Sepolia while you set up. Untick it to accept real USDC on Base. |
| Checkout expiry        | How long the buyer has to pay. Keep it at or below WooCommerce's **Hold stock** setting (default 60 minutes).  |

Click **Save changes**. The plugin checks the key with Layer Flow Gateway straight away and shows **"Layer Flow Gateway API key verified."** If the key is wrong or revoked, you'll see the reason instead.

The payment method now appears on both the block-based checkout and the classic checkout. Payments are always **USDC on Base**.

## How orders update

| What happened on Layer Flow Gateway                           | WooCommerce order                                                                                                                 |
| ------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| Payment confirmed                                             | **Processing** (or **Completed** for virtual/downloadable products). The transaction hash is saved as the order's transaction ID. |
| Underpaid, overpaid, wrong token or network, or manual review | **On hold**, with a note explaining why.                                                                                          |
| Wallet screening failed                                       | **Failed**.                                                                                                                       |
| Checkout expired                                              | A note only. A late payment still completes the order.                                                                            |

Every state change is added to the order notes, and the order page shows the payment link and transaction hash under the billing address.

Buyers who click **Cancel payment** go back to the order's **Pay for order** page and can try again. If they retry within the expiry window, they get the same checkout — you aren't charged for a second payment link.

## Revoking a key

Revoking the key in **Settings → API Keys** stops new checkouts immediately: buyers see **"Layer Flow Gateway is currently unavailable. Please try again or choose another payment method."** To resume, create a new key and paste it into the plugin settings.

## Troubleshooting

**The payment method doesn't show at checkout.** Check that the store currency is USD (an admin notice appears if it isn't), the plugin is enabled, and an API key is saved.

**Buyers see "Layer Flow Gateway is currently unavailable".** Re-save the plugin settings to see why, or open **WooCommerce → Status → Logs** and pick the `layer-flow-gateway` log. Common causes:

| Log shows                               | Fix                                                                            |
| --------------------------------------- | ------------------------------------------------------------------------------ |
| `HTTP 401`                              | The API key is wrong or was revoked. Create a new key and paste it again.      |
| `HTTP 403` with a plan or trial message | Your plan's payment-link allowance is used up. Check billing in the dashboard. |
| `HTTP 403` otherwise                    | The key or business was disabled by Layer Flow Gateway. Contact support.       |
| `HTTP 429`                              | More than 60 checkouts started in a minute. Buyers can retry shortly.          |

**A buyer paid but the order is still Pending payment.** The webhook couldn't reach your site — a firewall, security plugin, or maintenance mode blocking `/wc-api/layer_flow_gateway/` is the usual cause. The order still updates when the buyer lands on the order-received page. Also check that the webhook signing secret matches the API key: a wrong secret is logged as "Rejected webhook".

**Can I refund from WooCommerce?** Not yet — refund from the Layer Flow Gateway dashboard.
