BchainPayBchainPay

WordPress / WooCommerce

The BchainPay plugin adds a "Pay with Crypto" gateway to WooCommerce. Customers can pay with ETH, USDT, USDC, DAI, SOL, TRX, BNB, and BUSD across four networks directly from your checkout page — no code required.

Requirements

RequirementMinimum version
WordPress6.3+
WooCommerce8.0+
PHP8.1+
BchainPay accountAny plan

You will need an API key and a webhook secret from the BchainPay Dashboard.

Installation

  1. Download the latest bchainpay.zip from the BchainPay Dashboard → Integrations page.
  2. In your WordPress admin, go to Plugins → Add New → Upload Plugin.
  3. Upload the ZIP file and click Install Now.
  4. Click Activate Plugin.

The gateway now appears under WooCommerce → Settings → Payments.

Configuration

Navigate to WooCommerce → Settings → Payments → BchainPay to configure the plugin.

Required settings

SettingDescription
API KeyYour BchainPay API key. Starts with pk_live_ (production) or pk_test_ (sandbox).
Webhook SecretThe signing secret used to verify incoming webhooks. Copy this from the Dashboard → Webhooks page.

Optional settings

SettingDefaultDescription
API URLhttps://api.bchainpay.comOverride only if you use a custom API proxy or the sandbox URL.
Default NetworkethereumThe blockchain network used when the customer doesn't choose one.
Default TokenUSDTThe token used when the customer doesn't choose one.
Allow Token ChoiceyesShow network + token dropdowns on the checkout page so the customer can pick how they pay.
Payment Timeout30 (minutes)How long the customer has to send funds before the payment expires. Drives the countdown timer.
Auto ConfirmyesAutomatically confirm the payment intent after address generation. Recommended for most stores.
Settlement Currency(blank)Optional settlement currency (e.g. USD). Leave blank to use the store currency.

Payment flow

Here's what happens from the customer's perspective:

  1. Checkout — The customer selects "Pay with Crypto" as their payment method.
  2. Choose crypto — If Allow Token Choice is enabled, two dropdowns appear: Network (Ethereum, BNB Chain, Solana, Tron) and Token (varies by network). Otherwise the store defaults are used.
  3. Place order — The plugin creates a payment intent via the BchainPay API, generates a deposit address, and (if Auto Confirm is on) confirms the intent automatically.
  4. Payment page — The customer is redirected to a payment instructions page showing:
    • The blockchain address to send funds to
    • A scannable QR code
    • A countdown timer (persists across page reloads)
  5. Send funds — The customer sends the exact amount from their wallet.
  6. Confirmation — The page polls for status updates every 12 seconds. Once the BchainPay webhook confirms the payment, the order moves to Processing (or Completed) and the customer sees a success message.

Webhook setup

The plugin exposes a dedicated webhook endpoint. You must register it in the BchainPay Dashboard for payments to be confirmed automatically.

  1. Go to the BchainPay Dashboard → Webhooks.
  2. Click Add Endpoint.
  3. Set the URL to:
https://yoursite.com/wp-json/bchainpay/v1/webhook
  1. Select the events you want to receive. At minimum subscribe to payment_intent.completed and payment_intent.expired. For the richest order lifecycle, subscribe to all payment_intent.* events — the plugin also handles payment_detected, confirmed, and failed.
  2. Copy the Signing Secret shown after saving and paste it into the plugin's Webhook Secret field in WooCommerce.

How verification works

Every incoming webhook includes an X-Webhook-Signature HMAC-SHA256 header. The plugin verifies this against your webhook secret and rejects any request with an invalid or missing signature. Events are also deduplicated by event ID, so replayed webhooks are safely ignored.

Supported networks and tokens

NetworkTokens
EthereumETH, USDT, USDC, DAI
BNB ChainBNB, USDT, USDC, BUSD
SolanaSOL, USDT, USDC
TronTRX, USDT, USDC

When Allow Token Choice is enabled, the token dropdown updates automatically based on the selected network (cascading dropdowns).

Order metadata

The plugin stores the following metadata on each WooCommerce order for reference and debugging:

Meta keyValue
_bchainpay_intent_idBchainPay payment intent ID
_bchainpay_addressBlockchain deposit address
_bchainpay_networkNetwork used (e.g. ethereum)
_bchainpay_tokenToken used (e.g. USDT)
_bchainpay_amount_centsAmount in cents (fiat)
_bchainpay_currencyStore currency (ISO-4217)
_bchainpay_statusCurrent intent status
_bchainpay_expires_atExpiry as ISO 8601 timestamp
_bchainpay_crypto_amountCrypto amount in smallest unit (e.g. lamports, wei)
_bchainpay_crypto_amount_decimalHuman-readable crypto amount (e.g. 0.042)
_bchainpay_token_price_centsToken price in USD cents at time of order

You can view these in the WooCommerce order detail screen under Custom Fields or query them with get_post_meta().

Troubleshooting

"Invalid API key" error at checkout

  • Confirm your key in WooCommerce → Settings → Payments → BchainPay.
  • Production keys start with pk_live_, sandbox keys with pk_test_.
  • Make sure there are no trailing spaces.

Webhook not received / order stuck on "On Hold"

  • Verify the webhook URL is correct and publicly reachable:
    curl -I https://yoursite.com/wp-json/bchainpay/v1/webhook
    You should get a 200 or 405 (Method Not Allowed for GET) — not a 404.
  • Check the Dashboard → Webhooks → Logs for delivery failures.
  • Confirm the Webhook Secret in the plugin matches the one in the Dashboard.
  • If you use a security plugin (Wordfence, Sucuri, etc.), make sure it isn't blocking POST requests to the REST API.

Payment timer expires too quickly

Increase the Payment Timeout in plugin settings. 30 minutes is the default; 60 minutes is a safer choice for customers who need to transfer from an exchange.

Cascading dropdowns don't appear

  • Make sure Allow Token Choice is set to Yes.
  • Clear any page cache or CDN cache that may be serving a stale checkout page.
  • Check the browser console for JavaScript errors — a conflicting theme or plugin may be interfering.

Duplicate order notes / double status changes

The plugin deduplicates webhook events by event ID. If you see duplicates, check whether another integration (e.g. a custom webhook consumer) is also processing BchainPay events for the same order.

Last updated Edit on GitHub