PreCheckoutQuery¶
- class aiogram.types.pre_checkout_query.PreCheckoutQuery(*, id: str, from_user: User, currency: str, total_amount: int, invoice_payload: str, shipping_option_id: str | None = None, order_info: OrderInfo | None = None, **extra_data: Any)[source]¶
This object contains information about an incoming pre-checkout query.
Source: https://core.telegram.org/bots/api#precheckoutquery
- id: str¶
Unique query identifier
- currency: str¶
Three-letter ISO 4217 currency code, or ‘XTR’ for payments in Telegram Stars
- total_amount: int¶
Total price in the smallest units of the currency (integer, not float/double). For example, for a price of
US$ 1.45passamount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
- invoice_payload: str¶
Bot-specified invoice payload
- shipping_option_id: str | None¶
Optional. Identifier of the shipping option chosen by the user
- answer(ok: bool, error_message: str | None = None, **kwargs: Any) AnswerPreCheckoutQuery[source]¶
Shortcut for method
aiogram.methods.answer_pre_checkout_query.AnswerPreCheckoutQuerywill automatically fill method attributes:pre_checkout_query_id
Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an
aiogram.types.update.Updatewith the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success,Trueis returned. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.Source: https://core.telegram.org/bots/api#answerprecheckoutquery
- Parameters:
ok – Specify
Trueif everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. UseFalseif there are any problems.error_message – Required if ok is
False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. “Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!”). Telegram will display this message to the user.
- Returns:
instance of method
aiogram.methods.answer_pre_checkout_query.AnswerPreCheckoutQuery