-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Description
Steps to reproduce
-
Just make a test payment as shown in the official example https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/paymentbot.py
-
Add the payment handlers AFTER a conversation handler, like this:
conv_handler = ConversationHandler(
...
)
# Add command handler to start the payment invoice
dp.add_handler(CommandHandler("shipping", start_with_shipping_callback))
dp.add_handler(CommandHandler("noshipping", start_without_shipping_callback))
# Optional handler if your product requires shipping
dp.add_handler(ShippingQueryHandler(shipping_callback))
# Pre-checkout handler to final check
dp.add_handler(PreCheckoutQueryHandler(precheckout_callback))
# Success! Notify your user!
dp.add_handler(MessageHandler(Filters.successful_payment, successful_payment_callback))
- Run it and try to make a payment (I used /noshipping).
Expected behaviour
It should let you make the full payment successfully.
Actual behaviour
It lets you type all payment information, but in the last step, when clicking the last "Pay" button, it crash (see Logs) and doesn't call precheckout_callback function throw PreCheckoutQueryHandler.
Additional information
- It works perfectly if you add it BEFORE the ConversationHandler.
- It seems to be recognized as if payment handlers were located inside the ConversationHandler.
- I don't think it to affect this issue, but I'm using Stripe payment in testing mode.
Configuration
I'm using the last version up to date. (e8fac19)
Logs
2017-12-02 17:31:52,827 - telegram.ext.dispatcher - ERROR - An uncaught error was raised while processing the update
Traceback (most recent call last):
File "C:\Users\Carlos\Documents\Programacion\TelegramBots\Pickatext\telegram\ext\dispatcher.py", line 278, in process_update
for handler in (x for x in self.handlers[group] if x.check_update(update)):
File "C:\Users\Carlos\Documents\Programacion\TelegramBots\Pickatext\telegram\ext\dispatcher.py", line 278, in <genexpr>
for handler in (x for x in self.handlers[group] if x.check_update(update)):
File "C:\Users\Carlos\Documents\Programacion\TelegramBots\Pickatext\telegram\ext\conversationhandler.py", line 215, in check_update
key = self._get_key(update)
File "C:\Users\Carlos\Documents\Programacion\TelegramBots\Pickatext\telegram\ext\conversationhandler.py", line 185, in _get_key
key.append(chat.id)
AttributeError: 'NoneType' object has no attribute 'id'
elatonsev
Metadata
Metadata
Assignees
Labels
No labels