async def start_pay(call: types.CallbackQuery):
keyboard = types.InlineKeyboardMarkup()
keyboard.add(types.InlineKeyboardButton(text='Оплатить', pay=True))
keyboard.add(types.InlineKeyboardButton(text='Назад', callback_data=f"select_pay_purchase"))
pay = call.data
if pay == "yookassa_pay":
title = ""
description = ""
elif pay == "sber_pay":
title = ""
description = ""
await bot.delete_message(call.message.chat.id, call.message.message_id)
user_id = int(db_hendlers.get_user_by_username(call.message.chat.username).get('id'))
items = db_hendlers.get_basked(user_id)
PRICE = []
for item in items:
product_id = item.get('product_id')
count = item.get('count')
product = db_hendlers.get_product(product_id)
product_name = product.get('name')
product_price = round(product.get('price'), 2)
total_price = int(product_price * count * 100)
PRICE.append(types.LabeledPrice(label=f"{product_name}", amount=total_price))
await bot.send_invoice(
call.message.chat.id,
title=title,
description=description,
provider_token=PAY.get(pay),
currency="rub",
is_flexible=False,
prices=PRICE,
start_parameter="test_start_parameter",
payload="test_invoice",
reply_markup=keyboard
)