如何使用远程机器人发送 send_invoice 方法?

how to send send_invoice method using telebot?

所以,我正在做电报上的机器人,我希望它能发送发票。 这是我尝试发送发票的代码:

bot.send_invoice(chat_id=chat_id, title="Flowers Delivery", description=description_of_package,
                 invoice_payload='some-invoice-payload-for-internal-use',
                 provider_token=keys.TEST_TRANZZO_PAYMENT, currency="UAH",
                 prices=[{'label': 'flowers', 'amount': 1000}], start_parameter="test-start-parameter")

这是我得到的错误:

2021-05-26 10:50:27,091 (__init__.py:544 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: there must be at least one price"

如果你使用的是telebot库,这个example page表明你需要导入LabeledPrice

from telebot.types import LabeledPrice

prices = [LabeledPrice(label='Working Time Machine', amount=5750),
    LabeledPrice('Gift wrapping', 500)]