K Khay logo
K Khay
Get Started
npm: @kkhay/reactv1.0.4React 18 & 19 Ready

React & Next.js UI SDK

The official UI drop-in component and headless hook library for React and Next.js applications. Features a modern frosted glass checkout modal, high-resolution SVG QR codes, live blockchain confirmation listener, and zero CSS collisions.

1. Installation

Install in React Project
$npm install @kkhay/react

2. Drop-in Checkout Button (<KkhayPayButton />)

Mounts a sleek payment button that automatically opens the modal, generates dynamic QR codes, and notifies you when on-chain payment is confirmed:

CheckoutPage.tsx
"use client"
import { KkhayPayButton } from "@kkhay/react"
export default function CheckoutPage() {
return (
<div className="p-8">
<h2 className="text-xl font-bold">Complete Your Purchase</h2>
<KkhayPayButton
apiKey="kkhay_live_YOUR_PUBLIC_KEY"
amount={49.99}
currency="USD"
orderId="ORDER-4401"
title="1-Year Premium Pass"
payNetwork="bsc" // Optional: preselect BSC, Polygon, Solana...
payToken="USDT" // Optional: preselect USDT, USDC, BTC...
onSuccess={(invoice) => {
console.log("Payment confirmed on-chain!", invoice.id)
window.location.href = "/checkout/thank-you"
}}
onCancel={() => {
console.log("Modal closed by user")
}}
/>
</div>
)
}

3. Headless UI Hook (useKkhayPayment)

For custom designs, use the headless hook to manage payment state, timer countdown, and status polling:

CustomCheckout.tsx
"use client"
import { useKkhayPayment } from "@kkhay/react"
export function CustomCheckout() {
const {
openModal,
status, // "idle" | "waiting" | "paid" | "expired"
amountPaid,
depositAddress,
timeRemaining,
} = useKkhayPayment({
apiKey: "kkhay_live_YOUR_KEY",
amount: 100,
currency: "USD",
})
return (
<button
onClick={openModal}
className="bg-emerald-500 text-white font-bold py-2 px-4 rounded"
>
Pay with 500+ Cryptos ({status})
</button>
)
}