Telegram Bot API
🌐 English

answerPreCheckoutQuery

Category: Payments · Bot API 10.3 · Official documentation

Answers a pre-checkout query.

Returns: On success, returns True.

Parameters

ParameterTypeRequiredDescription
pre_checkout_query_idStringYesPre-checkout query ID
okBooleanYestrue if everything is OK
error_messageStringOptionalError message (if ok=false)

Parameter descriptions are concise summaries; see the official documentation for the full text.

Example request

curl

curl -s -X POST "https://api.telegram.org/bot$TOKEN/answerPreCheckoutQuery" \
  -H "Content-Type: application/json" \
  -d '{"pre_checkout_query_id":"PRE_CHECKOUT_QUERY_ID","ok":true}'

Python

import requests

TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
    f"https://api.telegram.org/bot{TOKEN}/answerPreCheckoutQuery",
    json={
        "pre_checkout_query_id": "PRE_CHECKOUT_QUERY_ID",
        "ok": True
    },
    timeout=30,
)
print(resp.json())

JavaScript

const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/answerPreCheckoutQuery`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "pre_checkout_query_id": "PRE_CHECKOUT_QUERY_ID",
    "ok": true
  }),
});
console.log(await res.json());

Step-by-step guide: How to Create a Telegram Bot: Step by Step with BotFather and Python