npm: @kkhay/telegramv1.0.4grammY & Telegram Mini Apps
Telegram Bots & Mini Apps SDK
The official grammY and Telegram Mini Apps (TMA) crypto payment plugin for K Khay Gateway. Accept USDT, USDC, BTC, SOL, TON, and 500+ cryptos directly inside Telegram with real-time status re-checks, interactive inline keyboards, and seamless popup checkouts.
1. Installation
Install grammY & K Khay Telegram Plugin
$npm install @kkhay/telegram grammy
2. Telegram Bot Example (grammY)
When a user runs /pay, generate an invoice and render an interactive inline keyboard. Clicking "🔄 Check Status" automatically checks the blockchain and updates the message:
bot.ts
import { Bot } from "grammy"import { kkhayPlugin } from "@kkhay/telegram" const bot = new Bot(process.env.TELEGRAM_BOT_TOKEN!) // Register K Khay payment pluginbot.use(kkhayPlugin({ apiKey: process.env.KKHAY_API_KEY!,})) // /pay command handlerbot.command("pay", async (ctx) => { await ctx.replyWithKkhayInvoice({ amount: 15.00, currency: "USD", payNetwork: "ton", // Native TON, Solana, BSC, etc. payToken: "TON", orderId: `TG-${ctx.from?.id}-${Date.now()}`, title: "Telegram Channel VIP Subscription", // Opens checkout directly in Telegram Mini App popup: openInMiniApp: true, })}) bot.start()