WooCommerce Plugin
The Open Pay for WooCommerce plugin lets WordPress/WooCommerce stores accept cryptocurrency payments (USDT, USDC, BNB) that settle in LKR. Customers are redirected to a hosted checkout page to complete payment.Requirements
- WordPress 6.0+
- WooCommerce 8.0+
- PHP 8.1+
- An Open Pay merchant account with API credentials
Installation
Download the Plugin
Download the plugin from the GitHub repository or clone it:Alternatively, download the
openpay-gateway folder and upload it to wp-content/plugins/.Activate the Plugin
In your WordPress admin panel, go to Plugins > Installed Plugins and activate Open Pay for WooCommerce.
Configure API Credentials
Navigate to WooCommerce > Settings > Payments > Open Pay and enter your credentials:
| Setting | Description |
|---|---|
| Enable/Disable | Toggle the payment gateway on or off |
| Title | Payment method name shown to customers (default: “Pay with Crypto”) |
| Description | Description shown at checkout |
| API Key | Your full API key in the format ak_live_xxx.sk_live_yyy |
| API Base URL | API endpoint (default: https://olp-api.nipuntheekshana.com) |
The API key field expects both the key ID and secret combined with a dot separator:
ak_live_xxx.sk_live_yyy. Get this from the Merchant Portal under Integrations.Configure the Webhook
In the Open Pay Merchant Portal, configure your webhook URL to:Subscribe to these events:
payment.paidpayment.expiredpayment.failed
How It Works
Session Creation
The plugin creates a checkout session via the Open Pay API with the order total, currency, line items, and callback URLs. The request is signed with HMAC-SHA256.
Redirect
The customer is redirected to the hosted Open Pay checkout page where they can select a cryptocurrency and complete payment.
Checkout Session Payload
The plugin sends this data when creating a checkout session:HMAC-SHA256 Request Signing
Every API request is signed automatically by the plugin:| Header | Value |
|---|---|
Content-Type | application/json |
x-api-key | API key ID (ak_live_xxx) |
x-timestamp | Unix timestamp in milliseconds |
x-signature | HMAC-SHA256 hex signature |
Order Status Mapping
The plugin maps Open Pay webhook events to WooCommerce order statuses:| Webhook Event | WooCommerce Status | Description |
|---|---|---|
| (order placed) | Pending payment | Order created, awaiting crypto payment |
payment.paid | Processing | Payment confirmed on-chain |
payment.expired | Cancelled | Checkout session expired without payment |
payment.failed | Failed | Payment transaction failed |
Supported Currencies
The plugin sends the WooCommerce order currency to Open Pay. Supported fiat currencies for pricing:| Currency | Code |
|---|---|
| US Dollar | USD |
| Sri Lankan Rupee | LKR |
| Token | Network |
|---|---|
| USDT | BSC (BEP-20) |
| USDC | BSC (BEP-20) |
| BNB | BSC (Native) |
HPOS Compatibility
The plugin declares compatibility with WooCommerce High-Performance Order Storage (HPOS / Custom Order Tables). It works with both the legacywp_posts storage and the modern wp_wc_orders table.
Troubleshooting
Plugin shows 'WooCommerce required' error
Plugin shows 'WooCommerce required' error
WooCommerce must be installed and activated before the Open Pay plugin. Go to Plugins and ensure WooCommerce is active, then deactivate and reactivate Open Pay.
'API request failed' on checkout
'API request failed' on checkout
Check that your API key is correctly formatted as
ak_live_xxx.sk_live_yyy in the plugin settings. Also verify that the API Base URL is reachable from your server. Test with:Webhooks not updating order status
Webhooks not updating order status
Verify these items:
- Webhook URL is set correctly in the Merchant Portal:
https://yourstore.com/wc-api/openpay_webhook - HTTPS is required — webhooks will not be sent to HTTP endpoints
- Firewall is not blocking incoming POST requests from Open Pay servers
- Check WooCommerce > Status > Logs for any error messages
Order stuck in 'Pending payment' status
Order stuck in 'Pending payment' status
This means the webhook has not been received yet. Possible causes:
- The customer did not complete payment on the checkout page
- The webhook URL is misconfigured
- The checkout session expired (default: 15 minutes)
'Unknown error' from Open Pay API
'Unknown error' from Open Pay API
Enable WordPress debug logging to see the full API response:Check
wp-content/debug.log for detailed error messages from the Open Pay API.