WooCommerce Plugin
The OnCharge plugin adds a “Credit / Debit Card” payment method to your WooCommerce checkout. It supports both the classic shortcode checkout and the newer Blocks checkout.
Installation
- Download the plugin from your OnCharge dashboard or copy the
woo-plugin/directory towp-content/plugins/oncharge-gateway/ - Go to WordPress Admin > Plugins and activate OnCharge Secure Checkout
- Navigate to WooCommerce > Settings > Payments > OnCharge Secure Checkout
Configuration
Enter the following values from your OnCharge dashboard:
| Setting | Description |
|---|---|
| Store ID | Your OnCharge Store UUID |
| API Key | Starts with oc_key_... |
| API Secret | Starts with oc_sec_... (never shared publicly) |
| API Base URL | https://api.oncharge.io (default) |
| Pay Iframe URL | https://pay.oncharge.io (default) |
Classic Checkout
The plugin renders an iframe container in the payment method area. When the customer clicks “Place Order”, the plugin sends a postMessage to the OnCharge iframe which submits the payment via the PSP Drop-in component.
Blocks Checkout
The plugin registers with the WooCommerce Blocks payment method registry. The same iframe and postMessage flow works automatically. No additional configuration needed.
Callbacks
OnCharge sends payment status updates to your site at:
https://yoursite.com/?wc-api=oncharge_callbackThe callback payload is HMAC-signed with your store’s secret. The plugin verifies the signature and updates the WooCommerce order status accordingly.
Troubleshooting
Iframe not loading
- CSP blocking: If your site has a Content-Security-Policy header, add
pay.oncharge.ioto theframe-srcdirective. - Ad blockers: Some ad blockers may interfere. Test with blockers disabled.
- HTTPS required: The iframe will not load over HTTP. Ensure your site uses HTTPS.
Callback not arriving
- Verify the URL
?wc-api=oncharge_callbackis accessible from the internet. - Check that your firewall or security plugin is not blocking POST requests to the callback URL.
- Verify your SSL certificate is valid.
Signature mismatch
- Ensure the API Secret in WooCommerce settings matches the one from the OnCharge dashboard exactly.
- Check your server clock — timestamps must be within 5 minutes.