Documentation Index
Fetch the complete documentation index at: https://docs.khaime.com/llms.txt
Use this file to discover all available pages before exploring further.
WooCommerce Payment Flow
Checkout Compatibility
KhaimePay works with both WooCommerce checkout types:- Classic checkout — The traditional shortcode-based checkout (
[woocommerce_checkout]) - Block-based checkout — The modern Gutenberg block checkout (default since WooCommerce 8.3+)
Checkout Process
Step by Step
1. Customer Places Order
Customer fills in billing details and clicks “Place Order” with KhaimePay selected.2. Charge Created
The plugin sends a charge request to Khaime with:- Amount: The exact order total the customer sees at checkout (in their currency, minor units)
- Currency: Customer’s active currency
- Baseline amount: The equivalent amount in your store’s pricing currency
- Customer info: Email and name from the WooCommerce order
- Metadata: WooCommerce order ID, line items, and site URL
- Callback URL: Where to redirect after payment
The charge amount is taken directly from the WooCommerce order total, which includes all product prices, addon surcharges, shipping, fees, and taxes — already converted to the customer’s currency. This ensures the charge matches exactly what the customer saw.
3. Gateway Routing
Khaime returns the charge details including which gateway will process it:- Stripe: Plugin renders a Stripe Payment Element on the order-pay page where the customer enters card details
- Paystack: Plugin redirects the customer to Paystack’s hosted payment page
4. Payment Completion
- Stripe: Customer completes payment in the embedded form. Stripe redirects to the return URL.
- Paystack: Customer pays on Paystack’s page. Paystack redirects to the callback URL.
5. Verification
On return, the plugin verifies the payment:- Paystack: Verifies the transaction reference with the Khaime API. If the API is unavailable, the order is set to on-hold pending webhook confirmation.
- Stripe: Checks the payment status from URL parameters.
6. Webhook Confirmation
Khaime sends apayment.succeeded webhook to your store. The plugin:
- Verifies the HMAC signature
- Checks for duplicate events
- Marks the WooCommerce order as paid
- Stores the transaction ID and payment details
Refunds
The plugin supports WooCommerce’s built-in refund flow. When you initiate a refund from the order admin page:- The plugin sends a refund request to the Khaime API
- On success, the refund ID is stored on the order
- An order note is added with the refund details
refund.completed webhook when the refund is processed, adding a confirmation note to the order.
Order Metadata
After payment, the plugin stores these fields on the WooCommerce order for reference:| Field | Description |
|---|---|
| Charge ID | Unique Khaime charge identifier |
| Payment Gateway | Which gateway processed the payment (e.g. Stripe, Paystack) |
| Transaction ID | Khaime transaction ID |
| Environment | Whether the payment was sandbox or live |
| Customer Paid Amount | The amount the customer actually paid |
| Customer Paid Currency | The currency the customer paid in |
