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#
- Download the plugin ZIP from GitHub Releases or your Dashboard
- In WordPress admin, go to Plugins > Add New > Upload Plugin
- Select the downloaded ZIP file
- Click Install Now
- Click Activate
Method 2: Manual Upload#
- Download the plugin ZIP
- Extract it to your server:
unzip directcryptopay-wordpress.zip -d /var/www/html/wp-content/plugins/
- In WordPress admin, go to Plugins
- 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:
- Create account at directcryptopay.com
- Create integration in Dashboard > Integrations
- Copy Integration ID (starts with
int_) - Paste in plugin settings and save
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¤cy=ETH&status=success
Method 2: Gutenberg Block (Visual Editor)#
- In the page/post editor, click the + button to add a block
- Search for DirectCryptoPay Payment Button
- Configure amount, label, and currency in block settings
- Publish your page
Method 3: WooCommerce Gateway (E-commerce)#
The plugin adds a native WooCommerce payment gateway for checkout.
Setup#
- Go to WooCommerce > Settings > Payments
- Find DirectCryptoPay in the payment methods list
- 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.
Webhook Setup (Recommended)#
For server-side payment verification:
- Copy the Webhook URL displayed in the gateway settings (format:
https://yoursite.com/?wc-api=wc_gateway_directcryptopay) - In your DCP Dashboard, go to Integrations > your integration
- Set the Webhook URL to the copied URL
- Copy the Webhook Secret and paste it in the gateway settings
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#
- Customer adds products to cart and proceeds to checkout
- Customer selects "Pay with Crypto"
- WooCommerce creates the order with status Pending
- The DirectCryptoPay widget opens automatically
- Customer connects wallet, selects chain/token, and signs the transaction
- Widget shows "Processing" then "Confirmed" status
- Order status automatically updates to Processing
- 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:
- In the DCP Dashboard, ensure your integration uses testnet chains
- Get test tokens:
- Sepolia ETH: sepoliafaucet.com
- Amoy USDC: faucet.circle.com
- Place a test order in your store
- Pay with test tokens
- Verify the order updates in WooCommerce
Switching to Mainnet#
- Create a mainnet integration in your production dashboard
- Update the Integration ID in plugin settings
- Save settings
- Place a small real test payment to verify
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:
- Clear your WordPress cache plugin
- Clear Cloudflare or CDN cache (if applicable)
- Clear browser cache
Plugin Conflicts#
If the widget fails to load:
- Temporarily disable other plugins to identify conflicts
- Switch to a default WordPress theme (e.g., Twenty Twenty-Four) to rule out theme issues
- Check that your theme does not have conflicting JavaScript