> ## Documentation Index
> Fetch the complete documentation index at: https://docs.enso.build/llms.txt
> Use this file to discover all available pages before exploring further.

# Checkout Widget

> A React component for seamless cryptocurrency deposits from connected wallets

The Checkout Widget enables wallet-based deposits with built-in cross-chain routing and DeFi token swapping capabilities.

> [card] [Try the Demo](https://checkout.enso.build/)
>
> Try out the checkout flow

> [card] [Integration Guide](#integrate)
>
> Add to your app

Key features include:

* **Cross-chain deposits**: Automatic routing between different blockchain networks
* **Real-time quotes**: Live pricing and gas estimates
* **Customizable theming**: Full control over appearance and branding
* **Transaction tracking**: Real-time status updates with block explorer links

![Route Widget Flow](https://mintcdn.com/enso/LXMmUdnNCqUooVis/images/templates/checkout-widget.png?fit=max\&auto=format\&n=LXMmUdnNCqUooVis\&q=85\&s=b4f2c6dd4c6d17f57a518707cd8a34c9)

## How it Works

The widget connects to the connected wallet and allows user to:

1. Select token
2. Enter amount to spend
3. Check quote execution quote and parameters
4. Execute operation and track progress including cross-chain execution

## Integrate

**1. Install the package**

Install the widget:

```
npm i @ensofinance/checkout-widget
```

**2. API key**

You can get an API key from the [Developer Portal](https://developers.enso.build).

**3. Basic implementation**

Import and configure the widget.

> [!NOTE]
>
> Any of the [tokens](https://docs.enso.build/api-reference/tokens/tokens.md) or [nontokenized positions](https://docs.enso.build/api-reference/tokens/nontokenized-positions.md) can be used as `tokenOut`

> [tab] Checkout Modal
>
> ```tsx theme={null}
> import { useState } from "react";
> import { CheckoutModal } from "@ensofinance/checkout-widget";
>
> export function MyCheckoutComponentModal() {
>   const [isCheckoutActive, setIsCheckoutActive] = useState(false);
>
>   return (
>     <CheckoutModal
>       config={{
>         apiKey: "YOUR_API_KEY",
>         tokenOut: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
>         chainIdOut: 8453,
>       }}
>       isActive={isCheckoutActive}
>       setIsActive={setIsCheckoutActive}
>     />
>   );
> }
> ```

> [tab] Standalone Checkout
>
> ```tsx theme={null}
> import { Checkout } from "@ensofinance/checkout-widget";
>
> export function MyCheckoutComponent() {
>   return (
>     <div className="checkout-container">
>       <Checkout
>         config={{
>           apiKey: "YOUR_API_KEY",
>           tokenOut: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
>           chainIdOut: 8453,
>         }}
>       />
>     </div>
>   );
> }
> ```

**4. Setup Web3 providers**

The widget requires Wagmi and React Query providers. Set up your app's root component:

```tsx theme={null}
import { WagmiProvider, createConfig, http } from "wagmi";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { base, mainnet, arbitrum } from "wagmi/chains";
import { injected, walletConnect } from "wagmi/connectors";

// Configure supported chains and connectors
const config = createConfig({
  chains: [mainnet, base, arbitrum],
  connectors: [
    injected(), // MetaMask, Rabby, etc.
    walletConnect({
      projectId: "YOUR_WALLETCONNECT_PROJECT_ID",
    }),
  ],
  transports: {
    [mainnet.id]: http(),
    [base.id]: http(),
    [arbitrum.id]: http(),
  },
});

const queryClient = new QueryClient();

function App() {
  return (
    <WagmiProvider config={config}>
      <QueryClientProvider client={queryClient}>
        {/* Your app components */}
        <MyCheckoutComponent />
      </QueryClientProvider>
    </WagmiProvider>
  );
}
```

**5. Theme customization**

The widget accepts a complete Chakra UI v3 `SystemConfig` for theming.

> [!TIP]
>
> For advanced theming, refer to the [Chakra UI theming documentation](https://chakra-ui.com/docs/theming/semantic-tokens).

```tsx theme={null}
import { useState } from "react";
import { CheckoutModal, type WidgetTheme } from "@ensofinance/checkout-widget";
const customTheme: WidgetTheme = {
  theme: {
    semanticTokens: {
      colors: {
        // Background colors
        bg: { value: "#ffffff" },
        "bg.subtle": { value: "#f8fafc" },
        "bg.emphasized": { value: "#f1f5f9" },
        // Foreground/text colors
        fg: { value: "#0f172a" },
        "fg.muted": { value: "#64748b" },
        "fg.subtle": { value: "#94a3b8" },

        // Border colors
        border: { value: "#e2e8f0" },
        "border.emphasized": { value: "#cbd5e1" },

        // Primary accent color
        primary: { value: "#3b82f6" },
        "primary.emphasis": { value: "#2563eb" },

        // Status colors
        success: { value: "#10b981" },
        warning: { value: "#f59e0b" },
        error: { value: "#ef4444" },
      },
    },
    // Custom button variants
    recipes: {
      button: {
        variants: {
          variant: {
            solid: {
              bg: "primary",
              color: "white",
              _hover: { bg: "primary.emphasis" },
            },
          },
        },
      },
    },
  },
};
function App() {
  const [isCheckoutActive, setIsCheckoutActive] = useState(false);

  return (
    <CheckoutModal
      config={{
        apiKey: "YOUR_API_KEY",
        tokenOut: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        chainIdOut: 8453,
        theme: customTheme,
      }}
      isActive={isCheckoutActive}
      setIsActive={setIsCheckoutActive}
    />
  );
}
```

## Configuration Props

### CheckoutConfig Properties

The following checkout config exists:

| Parameter | Type | Description | Required |
| - | - | - | - |
| `apiKey` | `string` | Your Enso API key | Yes |
| `tokenOut` | `string` | Destination token address | Yes |
| `chainIdOut` | `number` | Destination chain ID | Yes |
| `recipient` | `string` | Recipient address for the output tokens. Defaults to the connected wallet's smart account | No |
| `slippage` | `number` | Slippage tolerance in basis points. Defaults to `200` | No |
| `theme` | `WidgetTheme` | Custom Chakra UI theme config | No |

### CheckoutProps

The standalone `Checkout` component accepts:

| Parameter | Type | Description | Required |
| - | - | - | - |
| `config` | `CheckoutConfig` | Widget [configuration object](#checkout-config-properties) | Yes |
| `wrapper` | `ComponentType` | Custom wrapper component for the widget | No |
| `onClose` | `() => void` | Close callback function | No |

### CheckoutModalProps

The `CheckoutModal` expands `CheckoutConfig` with modal-related properties and callbacks:

| Parameter | Type | Description | Required |
| - | - | - | - |
| `config` | `CheckoutConfig` | Widget [configuration object](#checkout-config-properties) | Yes |
| `isActive` | `boolean` | Controls modal visibility | Yes |
| `setIsActive` | `(active: boolean) => void` | Modal state setter | Yes |
| `onClose` | `() => void` | Close callback function | No |

## Supported Networks

The widget supports deposits across all networks:

* Ethereum (Chain ID: 1)
* Base (Chain ID: 8453)
* Arbitrum (Chain ID: 42161)
* Optimism (Chain ID: 10)
* Polygon (Chain ID: 137)
* Avalanche (Chain ID: 43114)
* BSC (Chain ID: 56)
* And [many more](https://docs.enso.build/pages/build/reference/supported-networks.md)

## Learn more

* [Crosschain routing](https://docs.enso.build/pages/build/get-started/crosschain-routing.md)
* [Use Cases](https://docs.enso.build/pages/use-cases.md)

Updated 2025-09-23


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.