WooCommerce
The OnCharge Secure Checkout plugin (version 1.7.0) adds a "Credit / Debit Card" payment method to WooCommerce. It creates checkout sessions, embeds the checkout, updates orders from OnCharge's webhooks, sends each order's shipping address and reports tracking numbers automatically so delivered orders are paid out. Since 1.5.0 it also connects the store to OnCharge Advertising: the tracking tag, shop events and a product sync for Google and Meta shopping ads (see Advertising). No code is needed.
Requirements: WordPress 5.8+, WooCommerce 7.0+, PHP 7.4+, HTTPS. Compatible with High-Performance Order Storage (HPOS), the classic [woocommerce_checkout] checkout and the Blocks checkout.
Install#
- In the merchant portal, download the plugin ZIP for your store.
- In WordPress, go to Plugins → Add New → Upload Plugin, choose the ZIP, then Install Now and Activate.
- Go to WooCommerce → Settings → Payments → OnCharge Secure Checkout.
Configure#
| Setting | Value |
|---|---|
| Enable | Tick to show the payment method at checkout. |
| Title / Description | What shoppers see, e.g. "Credit / Debit Card". |
| Store ID | Your store's ID from the merchant portal. |
| API Key | oc_key_… |
| API Secret | oc_sec_… (kept on the server, never sent to the browser) |
| Webhook Signing Secret | oc_cbsec_…, shown once when you register the store's webhook URL (below). New in 1.4.0. |
| API Base URL | https://app.oncharge.io (leave the default) |
| Pay Iframe Base URL | https://app.oncharge.io (leave the default) |
| Debug Mode | Logs to wp-content/debug.log. Turn off in production. |
Make sure your store's domain (as in Settings → General → Site Address) is registered for the store under Security → Domains in the portal; the plugin sends it with every request.
Then register the plugin's webhook URL, https://<your store>/?wc-api=oncharge_callback, for the store in the portal and paste the signing secret it shows into Webhook Signing Secret.
How checkout works#
- When the shopper chooses the card method, the plugin creates a checkout session from the cart on your server and shows the OnCharge checkout in an iframe.
- At Place order, WooCommerce creates the order (on hold) and the plugin attaches the order ID and shipping address to the session.
- The shopper completes the payment in the iframe.
- OnCharge's webhook moves the order to Processing when the payment is captured.
| Webhook event | Order change |
|---|---|
payment.authorized, payment.captured | Payment complete (Processing). |
payment.refused, payment.cancelled, payment.expired | Failed. |
payment.pending | Order note. |
refund.succeeded, refund.failed | Order note (with the refunded amount on success). |
chargeback.opened | On hold, for review. |
chargeback.won, chargeback.lost | Order note. |
delivery.confirmed | Order note. |
Since 1.4.0 the plugin reads the v2 webhook format: it finds the order from data.session_id, checks the timestamped OnCharge-Signature first (with the Webhook Signing Secret, then the API secret; deliveries older than 5 minutes are refused), falls back to the legacy X-Oncharge-Signature only when the new header is absent, and ignores repeated deliveries of the same OnCharge-Event-Id.
Make sure your firewall, security plugin or CDN allows POST requests to ?wc-api=oncharge_callback.
Refunds made from the WooCommerce order screen are sent to OnCharge.
Shipping and tracking#
OnCharge releases an order's payout 1 day after the carrier confirms delivery to the shipping address (see Shipments & payouts). The plugin handles both halves:
- Shipping address: sent with the session, or attached at Place order. Orders that need no shipping (virtual or downloadable products) are left out.
- Tracking numbers: reported for orders paid through OnCharge when the order is marked Completed, when a shipping integration sends a ShipStation-style ship notification, and by an hourly sweep over the last 45 days of Processing and Completed orders.
Tracking numbers are read from:
| Source | Order meta |
|---|---|
| The plugin's OnCharge delivery box | _oncharge_tracking_items |
| WooCommerce Shipment Tracking, Advanced Shipment Tracking | _wc_shipment_tracking_items |
| WooCommerce Shipping labels | wc_connect_labels |
| ShipStation-style meta | _tracking_number + _tracking_provider |
| Anything else | the oncharge_order_shipments filter |
add_filter( 'oncharge_order_shipments', function ( $shipments, $order ) {
$shipments[] = array( 'carrier' => 'UPS', 'tracking_number' => '1Z999AA10123456784' );
return $shipments;
}, 10, 2 );The OnCharge delivery box on the order edit screen shows what was sent and the carrier's result, and lets you enter a carrier (USPS, UPS, FedEx, DHL Express) and tracking number by hand. Accepted and rejected numbers are added as order notes.
Advertising#
If you chose OnCharge Advertising, open WooCommerce → Settings → Integration → OnCharge Marketing. It uses the Store ID, API Key and API Secret above.
| Setting | What it does |
|---|---|
| Tracking tag | Adds the OnCharge tag (https://app.oncharge.io/js/v1/growth.js) and sends view_item, add_to_cart (classic, AJAX and Blocks), begin_checkout and purchase. The purchase uses the order's OnCharge session ID as its event ID, so it is not counted twice with OnCharge's server-side report. Checkout sessions carry the shopper's ad click IDs as metadata.attribution. |
| Cookie consent | With a consent plugin that supports the WP Consent API, visitors' marketing and statistics choices are passed to the tag, and ad IDs are not sent without consent. |
| Product sync | Sends published products and variations (price, sale price, stock, images, brand, GTIN/MPN, category) to OnCharge for Google Merchant Center and the Meta catalog: changes within about a minute, everything once a day, and products you delete are removed. Uses Action Scheduler. |
| Categories to exclude | Products in these categories and their subcategories are never advertised. |
| RUO categories | Products in these categories and their subcategories are labelled research-use-only (RUO) in your OnCharge catalog. The label is information only: they are sent to the ad platforms like any other product, each platform reviews them against its own policies, and the tag loads on their pages. |
The status panel on the same page shows the last sync, what was added or rejected, errors and the totals OnCharge holds, with Sync all products now. The plugin also adds the Google site-verification meta tag to your home page. Details: Advertising.
RUO compliance scanner#
Research-use-only (RUO) stores also install the OnCharge Compliance Scanner plugin, which serves the compliance feed so OnCharge can review a gated catalogue. It is read-only: it never changes, hides or gates your content, and shares only published products, pages and posts.
- Upload and activate the plugin (Plugins → Add New → Upload Plugin).
- In the merchant portal, start a store connection and copy the connection code (
occs_…, shown once). - In WordPress, go to Settings → OnCharge Compliance Scanner, paste the code and select Save connection code.
- Back in the portal, select Verify connection, then run a scan.
- Set up reviewer access: create a separate customer-level WordPress account with the same research access a verified buyer has, sign in as it once to check it shows products and prices, then enter its username under Reviewer access and tick the confirmation. Give the login to OnCharge yourself; the plugin never sends usernames or passwords.
The Compliance Scanner updates itself like Secure Checkout (from version 1.1.0; see Updates).
If your research gate blocks the WordPress REST API, allow the oncharge-compliance-scanner/v1 routes. A gate plugin can answer the catalogue check itself with the oncharge_compliance_scanner_reviewer_can_view_catalog filter.
Updates#
From version 1.6.0 the plugin updates itself. WordPress checks OnCharge for new versions twice a day and installs them in the background, the same way it updates plugins from WordPress.org.
- Signed: every update is signed with OnCharge's update key, and its checksum is verified before WordPress installs it. A changed or unsigned package is refused, so nothing else can push code to your store.
- Your API key: the download uses the store API key from the plugin settings. Keep it set, and updates keep working after you rotate it.
- Turning it off: Automatic updates are on by default. To install updates yourself instead, select Disable auto-updates next to the plugin on the Plugins screen; WordPress then shows each update for you to install.
Stores on 1.5.0 or earlier install 1.6.0 by hand once: download the ZIP from the merchant portal, upload it under Plugins → Add New → Upload Plugin, and choose Replace current with uploaded. Later versions arrive on their own.
Troubleshooting#
The payment form does not load
- Your site must use HTTPS.
- If you send a
Content-Security-Policy, addhttps://app.oncharge.iotoframe-src. - Your domain must be registered for the store; the checkout can only be framed by registered domains.
- Turn on Debug Mode and check
wp-content/debug.logfor the API error code.
Orders stay on hold
- Check that
?wc-api=oncharge_callbackis reachable from the internet and not blocked by a firewall or security plugin. - Check the order notes and
debug.logfor webhook errors.
invalid_signature or timestamp_expired in the log
- Paste the API secret again (no extra spaces) and check that it belongs to the same key.
- For webhook signature errors, paste the Webhook Signing Secret again; if you registered the webhook URL again, the portal issued a new secret.
- Make sure the server clock is correct (within 5 minutes).
domain_mismatch
- Register the exact host from Settings → General → Site Address (with or without
www) for the store.
Tracking numbers rejected
- See the order note for the reason. OnCharge confirms deliveries by USPS, UPS, FedEx and DHL Express.