DirectCryptoPay Docs

WordPress / WooCommerce Plugin

Accept cryptocurrency payments in your WooCommerce store with zero coding. The DirectCryptoPay plugin integrates directly into WooCommerce's checkout flow and also works as a standalone payment button on any WordPress page.

Version: 1.4.0 | License: GPLv2+

Features#

  • 3 integration methods: Shortcode, Gutenberg Block, WooCommerce Gateway
  • Multi-chain: Ethereum, Polygon, BNB Chain, Base, Arbitrum, Optimism, Avalanche
  • Smart token selector: Shows real wallet balances, customer picks chain & token
  • Non-custodial: Payments go directly to your wallet
  • Webhook verification: HMAC-SHA256 signature verification for server-side confirmation
  • Auto environment detection: Switches between testnet/mainnet based on site URL
  • Custom redirects: Success and error page redirects with payment data

Prerequisites#

  • WordPress 5.8 or later
  • WooCommerce 7.0 or later (for WooCommerce gateway only)
  • PHP 7.4 or later
  • A DirectCryptoPay account (create one here)

Installation#

Method 1: Upload via WordPress Admin#

  1. Download the plugin ZIP from GitHub Releases or your Dashboard
  2. In WordPress admin, go to Plugins > Add New > Upload Plugin
  3. Select the downloaded ZIP file
  4. Click Install Now
  5. Click Activate

Method 2: Manual Upload#

  1. Download the plugin ZIP
  2. Extract it to your server:
unzip directcryptopay-wordpress.zip -d /var/www/html/wp-content/plugins/
  1. In WordPress admin, go to Plugins
  2. Find DirectCryptoPay and click Activate

Configuration#

After activation, the plugin adds a DirectCryptoPay menu item in the WordPress sidebar with a 4-step setup wizard:

  1. Create account at directcryptopay.com
  2. Create integration in Dashboard > Integrations
  3. Copy Integration ID (starts with int_)
  4. Paste in plugin settings and save
Integration vs API Key: The WordPress plugin uses an Integration ID (not the raw API key). The Integration ID encapsulates your merchant configuration including wallet address, accepted chains, and tokens.

Integration Methods#

Method 1: Shortcode (Any Page)#

Add a payment button to any page, post, or widget:

[dcp_pay amount="10" label="Pay with Crypto"]

Shortcode Parameters#

Parameter Required Default Description
amount Yes 10 Amount in USD
label No Pay with Crypto Button text
currency No ETH Token to accept: ETH, USDC, USDT
success_url No Redirect URL after successful payment
error_url No Redirect URL if payment fails

Examples#

[dcp_pay amount="5" label="Donate" currency="ETH"]
[dcp_pay amount="25" label="Buy Premium" currency="USDC"]
[dcp_pay amount="99" label="Subscribe" success_url="https://yoursite.com/thank-you" error_url="https://yoursite.com/error"]

Success Page URL Parameters#

When using success_url, the redirect includes these query parameters:

Parameter Description
tx_hash Blockchain transaction hash
intent_id Payment intent ID
amount Payment amount in USD
currency Token used (ETH, USDC, etc.)
status success

Example: https://yoursite.com/thank-you?tx_hash=0x7f72...&intent_id=01KG...&amount=10&currency=ETH&status=success

Method 2: Gutenberg Block (Visual Editor)#

  1. In the page/post editor, click the + button to add a block
  2. Search for DirectCryptoPay Payment Button
  3. Configure amount, label, and currency in block settings
  4. Publish your page

Method 3: WooCommerce Gateway (E-commerce)#

The plugin adds a native WooCommerce payment gateway for checkout.

Setup#

  1. Go to WooCommerce > Settings > Payments
  2. Find DirectCryptoPay in the payment methods list
  3. Click Manage (or Set up)

Gateway Settings#

Setting Description Example
Enable/Disable Toggle the payment method on/off Checked
Title Displayed to customers at checkout "Pay with Crypto"
Description Additional text shown at checkout "Pay with ETH, USDC, or USDT"
Default Currency Default token (customer can still choose others) ETH
Webhook Secret From DCP Dashboard, for signature verification whsec_...

The Integration ID is inherited from the global DirectCryptoPay plugin settings.

For server-side payment verification:

  1. Copy the Webhook URL displayed in the gateway settings (format: https://yoursite.com/?wc-api=wc_gateway_directcryptopay)
  2. In your DCP Dashboard, go to Integrations > your integration
  3. Set the Webhook URL to the copied URL
  4. Copy the Webhook Secret and paste it in the gateway settings
Server-side verification: When configured, the DCP backend sends a payment.succeeded webhook when the payment is confirmed on-chain. This updates the order even if the customer closes their browser. The webhook supports HMAC-SHA256 signature verification for security.

Checkout Flow#

  1. Customer adds products to cart and proceeds to checkout
  2. Customer selects "Pay with Crypto"
  3. WooCommerce creates the order with status Pending
  4. The DirectCryptoPay widget opens automatically
  5. Customer connects wallet, selects chain/token, and signs the transaction
  6. Widget shows "Processing" then "Confirmed" status
  7. Order status automatically updates to Processing
  8. Customer is redirected to the WooCommerce thank-you page

Order Metadata#

After payment, the order stores these meta fields:

Meta Key Description
_dcp_tx_hash Blockchain transaction hash
_dcp_intent_id DirectCryptoPay payment intent ID
_dcp_chain_id Chain ID (e.g., 137 for Polygon)
_dcp_currency Token used (ETH, USDC, etc.)

Webhook Events Handled#

The WooCommerce gateway handles these webhook events:

Event Action
payment.succeeded Order marked as paid (Processing)
payment.failed Order marked as Failed
payment.expired Order marked as Cancelled, stock restored
payment.processing Order note added (TX detected on-chain)

Environment Detection#

The plugin auto-detects the environment based on your WordPress site URL:

Site URL contains Environment API URL
localhost / 127.0.0.1 Local dev http://localhost:4001
test. / staging. / dev. Preview https://preview-api.directcryptopay.com
Everything else Production https://api.directcryptopay.com

To override, add to wp-config.php:

define('DCP_ENV', 'production'); // or 'test' or 'local'

Testing with Testnet#

Before going live:

  1. In the DCP Dashboard, ensure your integration uses testnet chains
  2. Get test tokens:
  3. Place a test order in your store
  4. Pay with test tokens
  5. Verify the order updates in WooCommerce
Testnet payments are free and unlimited. They don't count toward your monthly transaction quota. See Pricing.

Switching to Mainnet#

  1. Create a mainnet integration in your production dashboard
  2. Update the Integration ID in plugin settings
  3. Save settings
  4. Place a small real test payment to verify
Before going live: Always verify your wallet address is correct in the DCP dashboard. Payments to an incorrect address cannot be recovered.

Troubleshooting#

Widget Not Appearing at Checkout#

  • Verify WooCommerce is active and up to date
  • Check that DirectCryptoPay is enabled in WooCommerce payment settings
  • Check browser console for JavaScript errors
  • Clear any WordPress caching plugins (WP Super Cache, W3 Total Cache, etc.)
  • Try in an incognito browser window

Order Status Not Updating#

  • Verify your site is accessible from the internet (webhooks cannot reach localhost)
  • Check the DCP dashboard for the payment status
  • Look at WooCommerce order notes for any error messages
  • Ensure your WordPress cron is running (wp-cron.php)
  • Verify the Webhook URL and Webhook Secret are correctly configured

Cache Issues#

If you see an outdated version of the payment widget:

  1. Clear your WordPress cache plugin
  2. Clear Cloudflare or CDN cache (if applicable)
  3. Clear browser cache

Plugin Conflicts#

If the widget fails to load:

  1. Temporarily disable other plugins to identify conflicts
  2. Switch to a default WordPress theme (e.g., Twenty Twenty-Four) to rule out theme issues
  3. Check that your theme does not have conflicting JavaScript
Need help? Contact support at [email protected] or visit the FAQ.