Skip to main content

Developer Reference

Technical details for developers integrating with or debugging the plugin. Store owners don’t need anything on this page — see Configuration instead.
The plugin does not currently expose PHP action or filter hooks. The extension points are the JavaScript API and the webhook endpoint below.

Environments & API URL

The plugin selects its API host from the Environment setting:
  • Live: https://api.khaime.com/api/v1
  • Sandbox: https://api.khaimedev.com/api/v1
To point the plugin at a local backend, define the KHAIME_API_URL constant in wp-config.php:
When set, it appears read-only under Developer overrides on the settings page.

Diagnostics Panel

A live diagnostics panel (geolocation detection, active-currency resolution, exchange-rate inspection, currency simulation, and a Flush All Caches button) is available on the settings page — but only in developer mode: it appears when KHAIME_API_URL points at a local host (localhost, 127.0.0.1, *.local, *.test). It is never shown on production stores.

JavaScript API

The client-side price converter exposes a public API on window.KhaimePriceConverter:
Useful if you inject price elements via JavaScript (quick-view modals, infinite scroll).

Webhook Endpoint

The plugin registers a REST endpoint to receive events from Khaime:

Security

Every request is verified before processing:
  1. Signature — HMAC-SHA256 over the raw body using the webhook secret, from the X-Khaime-Signature header
  2. Deduplication — each event’s X-Khaime-Event-Id is checked against a 48-hour replay window
  3. Payload validation — required fields are checked before processing

Handled events

Logging

Webhook events log to WooCommerce → Status → Logs under the khaime-webhooks source; API/currency activity logs under khaimepay.