A
A
Airat2021-12-03 20:59:38
Python
Airat, 2021-12-03 20:59:38

Link VK Pay and VKBottle to the bot. Did you write the code correctly?

I have been sitting for a long time and cannot figure out how to implement VK Pay to the bot on VKBottle. It sends a button with payment, everything is OK, but when you pay, it loads a second and displays the following message: "It is impossible to complete the operation. Please try later"

Here is the code, I think I messed up something and wrote something wrong. I read the documentation, but I'm a little confused and I hope you tell me :)

@bp.on.message(text='подписка')
async def pay(message: Message):
    num = 120156786 #  ID Группы
    pay = (
    Keyboard(one_time=False, inline=True)
    .add(VKPay(payload = None, hash=f'action=pay-to-group&amount=1&group_id={num}&aid=10'))
    .get_json()
    )
    await message.answer('Функции платной подписки:\n1)...\n2)...', keyboard=pay)

@bp.on.raw_event(GroupEventType.VKPAY_TRANSACTION, dataclass=GroupTypes.VkpayTransaction)
async def message_event_pay(event: GroupTypes.VkpayTransaction):
    # id_user = event.object.peer_id
    # print(id_user)

    if event.VkpayTransaction:
        bp.api.messages.edit(
        peer_id=event.object.peer_id,
        conversation_message_id=event.object.conversation_message_id,
        message='checking')

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question