> ## 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.

# Gateway Routing

> How Khaime selects the optimal payment gateway.

# Gateway Routing

Khaime automatically routes each payment to the best gateway based on the customer's currency and region. You don't need to configure or select gateways — it's handled for you.

## How It Works

1. You send a [charge request](/api-reference/payments/create-charge) with the customer's currency
2. Khaime selects the optimal gateway for that currency and region
3. The response tells you which checkout flow to use

## Checkout Flows

The charge response includes a `payment_gateway` field. Your integration needs to handle two checkout types:

| Flow         | When                        | What to do                                                                     |
| ------------ | --------------------------- | ------------------------------------------------------------------------------ |
| **Embedded** | `client_secret` is returned | Mount a payment element on your page using `client_secret` + `publishable_key` |
| **Redirect** | `payment_url` is returned   | Redirect the customer to the hosted payment page                               |

## Example Response

```json theme={null}
// Embedded flow
{
  "payment_gateway": "...",
  "client_secret": "pi_xxx_secret_xxx",
  "publishable_key": "pk_xxx",
  "charge_id": "charge_xxx"
}

// Redirect flow
{
  "payment_gateway": "...",
  "payment_url": "https://...",
  "charge_id": "charge_xxx"
}
```

## Supported Regions

Khaime supports payments across multiple regions including:

* **Africa** — Nigeria, Ghana, Kenya, South Africa, and more
* **North America** — United States, Canada
* **Europe** — UK, Eurozone
* **Asia-Pacific** — Australia and expanding

<Info>
  The list of supported currencies and regions is growing. Check the [multicurrency page](/payments/multicurrency) for the full list.
</Info>

## Integration Reference

See the [WooCommerce plugin payment flow](/plugins/woocommerce/payment-flow) for a working example that handles both embedded and redirect checkout flows.
