Skip to main content

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+)
No additional configuration is needed — the plugin registers with both automatically.

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 a payment.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:
  1. The plugin sends a refund request to the Khaime API
  2. On success, the refund ID is stored on the order
  3. An order note is added with the refund details
Khaime also sends a 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:
FieldDescription
Charge IDUnique Khaime charge identifier
Payment GatewayWhich gateway processed the payment (e.g. Stripe, Paystack)
Transaction IDKhaime transaction ID
EnvironmentWhether the payment was sandbox or live
Customer Paid AmountThe amount the customer actually paid
Customer Paid CurrencyThe currency the customer paid in
Gateway-specific fields (Stripe client secret, Paystack reference, etc.) are also stored for payment verification.