Как в bot.send_invoice добавить вторую inline кнопку?

Нужно отправить пользователю счет, добавив вторую inline кнопку "Отмена".

@bot.callback_query_handler(func=lambda call: call.data == 'card_payment')
def start_card_payment(call):
    tg_id = call.message.chat.id
    amount = get_amount_config(config.PATH_SETTINGS)
    bot.send_invoice(chat_id=tg_id,
                     title='title',
                     description=config.INVOICE_DESCRIPTION_TEXT,
                     provider_token=config.PROVIDER_TOKEN,
                     currency='RUB',
                     photo_url=None,
                     need_phone_number=False,
                     need_email=False,
                     is_flexible=False,
                     prices=[LabeledPrice(label='title',
                                          amount=int(amount))],
                     start_parameter='start_parameter',
                     invoice_payload='coupon'
                     )

Ответы (1 шт):

Автор решения: MyZik

Вам нужно передать аргумент reply_markup в Ваш метод bot.send_invoice(). Выглядеть это будет примерно так:

keyboard = InlineKeyboardMarkup()
keyboard.add(InlineKeyboardButton("Pay", pay=True))
keyboard.add(InlineKeyboardButton("Button 1", callback_data="cb_data_1"))
keyboard.add(InlineKeyboardButton("Button 2", callback_data="cb_data_2"))

bot.send_invoice(chat_id=tg_id,
                 title='title',
                 description=config.INVOICE_DESCRIPTION_TEXT,
                 provider_token=config.PROVIDER_TOKEN,
                 currency='RUB',
                 photo_url=None,
                 need_phone_number=False,
                 need_email=False,
                 is_flexible=False,
                 prices=[LabeledPrice(label='title',
                                      amount=int(amount))],
                 start_parameter='start_parameter',
                 invoice_payload='coupon',
                 reply_markup=keyboard
                 )
→ Ссылка