WooCommerce Integration
Accept crypto payments on your WooCommerce store with Pelago.
Installation
WordPress Plugin
- Download the Pelago WooCommerce Plugin
- Go to Plugins → Add New → Upload Plugin
- Upload and activate the plugin
- Navigate to WooCommerce → Settings → Payments → Pelago
Manual Installation
cd wp-content/plugins
git clone https://github.com/polyflow/pelago-woocommerce.git
Then activate in WordPress admin.
Configuration
Plugin Settings
Navigate to WooCommerce → Settings → Payments → Pelago:
| Setting | Description |
|---|---|
| Enable/Disable | Toggle Pelago payments |
| Title | Payment method name at checkout |
| Description | Checkout description |
| API Key | Your Pelago public key |
| API Secret | Your Pelago secret key |
| Merchant Wallet | Your crypto wallet address |
| Network | Default blockchain network |
| Cryptocurrencies | Accepted cryptocurrencies |
| Sandbox Mode | Use test environment |
Environment Variables (Optional)
// wp-config.php
define('PELAGO_API_KEY', 'pk_live_xxxxx');
define('PELAGO_API_SECRET', 'sk_live_xxxxx');
define('PELAGO_WALLET', 'GXXXXX...');
Payment Flow
Customization
Custom Button Text
// functions.php
add_filter('pelago_button_text', function($text) {
return 'Pay with Crypto 💰';
});
Custom Redirect URL
add_filter('pelago_redirect_url', function($url, $order) {
return home_url('/thank-you/?order=' . $order->get_id());
}, 10, 2);
Order Status Mapping
add_filter('pelago_order_status_completed', function() {
return 'completed'; // Default: 'processing'
});
Hooks & Actions
After Payment
add_action('pelago_payment_completed', function($order_id, $payment) {
$order = wc_get_order($order_id);
// Add custom order note
$order->add_order_note(sprintf(
'Paid via Pelago. TX: %s',
$payment['transactionHash']
));
// Trigger custom action
do_action('my_custom_payment_action', $order, $payment);
}, 10, 2);
Payment Failed
add_action('pelago_payment_failed', function($order_id, $reason) {
$order = wc_get_order($order_id);
$order->update_status('failed', 'Pelago payment failed: ' . $reason);
});
Multi-Currency
WooCommerce Currency Switcher compatibility:
add_filter('pelago_payment_currency', function($currency) {
// Get current display currency
if (function_exists('wcpmc_get_current_currency')) {
return wcpmc_get_current_currency();
}
return $currency;
});
Shortcode
Display Pelago payment button anywhere:
[pelago_button amount="99.99" currency="USD" product_id="123"]
REST API Endpoints
The plugin adds REST endpoints:
# Create payment
POST /wp-json/pelago/v1/payment
# Webhook handler
POST /wp-json/pelago/v1/webhook
Testing
Sandbox Mode
- Enable sandbox in plugin settings
- Use test API keys
- Create test orders
Debug Mode
// wp-config.php
define('PELAGO_DEBUG', true);
Logs are written to wp-content/debug.log.
Troubleshooting
Payment Not Showing
- Ensure plugin is activated
- Check WooCommerce payment settings
- Verify API credentials
Webhooks Not Working
- Check permalink settings (must not be "Plain")
- Verify webhook URL is accessible
- Check server logs for errors
SSL Required
Pelago requires HTTPS. Ensure your site has a valid SSL certificate.