How to get PreCheckoutQuery in Telegram?

#1

Hello, I am trying to implement the acceptance of payments through the Telegram Bot. I created the sendInvoice method, and now I need to implement the answerPreCheckoutQuery method. But it’s not entirely clear how to get an update with preCheckoutQuery after payment. Thank you in advance.

#2

So, this issue is resolved, but now another problem.

In Telegram two ways to get updates for the bot - “getUpdates” and “Webhooks”, but you cannot use them together. To make a payment, I have to get PreCheckoutQuery via Webhook. But when I switch to the Webhook mode, the bot naturally stops working, because getUpdates is no longer working. Then I tried to turn on the webhook only at the time of confirmation of the payment, and then immediately switch to getUpdates mode, and everything seems to be working, the payment passes, but after that the bot completely stops responding. “Ask a Question” action starts but the answer does not return. When I send answer to the bot, the logs show endless waiting for an answer to a question. What could be the problem?

(Daniel Beckett) #3

Hi @DmitrySpace

I believe you also emailed into the support desk for help with this. Did you see the response we sent on there? :slightly_smiling_face:

#4

Yes, I send message to you

#5

The question is still relevant! :grimacing:

1 Like
(Michael Araque) #6

I have the same problem i can get the precheckout_id via url with answerprecheckoutquery but in my code i try to get the Update to get ID automatically and i receive a blank response