Skip to main content
Deno 2 is finally here 🎉️
Learn more
Very Popular
Go to Latest
method Composer.prototype.preCheckoutQuery
import { Composer } from "https://deno.land/x/grammy@v1.31.2/composer.ts";

Registers middleware for pre-checkout queries. Telegram sends a pre-checkout query to your bot whenever a user has confirmed their payment and shipping details. You bot will then receive all information about the order and has to respond within 10 seconds with a confirmation of whether everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Check out https://core.telegram.org/bots/api#precheckoutquery to read more about pre-checkout queries.

bot.preCheckoutQuery('invoice_payload', async ctx => {
  // Answer the pre-checkout query, confer https://core.telegram.org/bots/api#answerprecheckoutquery
  await ctx.answerPreCheckoutQuery( ... )
})

Parameters

trigger: MaybeArray<string | RegExp>

The string to look for in the invoice payload

...middleware: Array<PreCheckoutQueryMiddleware<C>>

The middleware to register