A
A
aqualangist2022-01-23 13:08:39
Telegram
aqualangist, 2022-01-23 13:08:39

Why is the order stuck in the waiting_for_the_capture status?

Good afternoon!
After paying for the goods through the telegram bot, the order hangs in the "Awaiting confirmation" status. You have to confirm it manually on the Operations page in Yukassy's personal account.

Bot in python, aiogram.
Assumed that confirmation would automatically occur in @dp.pre_checkout_query_handler.
Below is the code of payment and confirmation methods.

#обработчик кнопки Пак - оплата товара
@dp.callback_query_handler(buy_callback.filter(item_name="pack"))
async def buying_pack(call: CallbackQuery, callback_data: dict):
    await bot.send_invoice(
        chat_id=call.from_user.id,
        title='Пак для сториз',
        description='Стикеры, элементы, фоны, шрифты',
        payload='pack_buy',
        provider_token=PAYMENT_TOKEN,
        currency='RUB',
        start_parameter='test_bot',
        prices=[{"label": "Руб", "amount": 10000}]
    )

#подтверждение наличия товара
@dp.pre_checkout_query_handler(lambda q: True)
async def process_pre_checkout_query(pre_checkout_query: types.PreCheckoutQuery):
    await bot.answer_pre_checkout_query(pre_checkout_query.id, ok=True)

#обработчик успешной оплаты
@dp.message_handler(content_types=ContentType.SUCCESSFUL_PAYMENT)
async def process_pay(message: types.Message):
    if message.successful_payment.invoice_payload == "pack_buy":
#отправляем ссылку на скачивание
        await bot.send_message(message.from_user.id, "Скачать здесь - " + URL_PACK)


Can you please tell me how to make automatic payment confirmation?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
aqualangist, 2022-02-08
@aqualangist

Not relevant - the problem was solved using the create_invoice method

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question