Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/grammy/mod.ts>Composer#preCheckoutQuery

The Telegram Bot Framework.
Very Popular
Go to Latest
method Composer.prototype.preCheckoutQuery
import { Composer } from "https://deno.land/x/grammy@v1.25.2/mod.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

Returns

Composer<PreCheckoutQueryContext<C>>