Skip to main content

WooCommerce Integration

Accept crypto payments on your WooCommerce store with Pelago.

Installation

WordPress Plugin

  1. Download the Pelago WooCommerce Plugin
  2. Go to PluginsAdd NewUpload Plugin
  3. Upload and activate the plugin
  4. Navigate to WooCommerceSettingsPaymentsPelago

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 WooCommerceSettingsPaymentsPelago:

SettingDescription
Enable/DisableToggle Pelago payments
TitlePayment method name at checkout
DescriptionCheckout description
API KeyYour Pelago public key
API SecretYour Pelago secret key
Merchant WalletYour crypto wallet address
NetworkDefault blockchain network
CryptocurrenciesAccepted cryptocurrencies
Sandbox ModeUse 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

  1. Enable sandbox in plugin settings
  2. Use test API keys
  3. Create test orders

Debug Mode

// wp-config.php
define('PELAGO_DEBUG', true);

Logs are written to wp-content/debug.log.

Troubleshooting

Payment Not Showing

  1. Ensure plugin is activated
  2. Check WooCommerce payment settings
  3. Verify API credentials

Webhooks Not Working

  1. Check permalink settings (must not be "Plain")
  2. Verify webhook URL is accessible
  3. Check server logs for errors

SSL Required

Pelago requires HTTPS. Ensure your site has a valid SSL certificate.

Next Steps