PyTelegramBotAPI 无法在 python3.9 上 send_invoice
PyTelegramBotAPi can't send_invoice on python3.9
我是第一次使用支付系统,我无法发送,它给出了这个错误:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/m1rsadikov/tele-bot/venv/lib/python3.8/site-packages/telebot/__init__.py", line 2140, in send_invoice
result = apihelper.send_invoice(
File "/home/m1rsadikov/tele-bot/venv/lib/python3.8/site-packages/telebot/apihelper.py", line 1353, in send_invoice
'prices': _convert_list_json_serializable(prices)}
File "/home/m1rsadikov/tele-bot/venv/lib/python3.8/site-packages/telebot/apihelper.py", line 1597, in _convert_list_json_serializable
for r in results:
TypeError: 'int' object is not iterable
这是我发送的:
bot.send_invoice(message.from_user.id, title='Working Time Machine',
description='Want to visit your great-great-great-grandparents?'
' Make a fortune at the races?'
' Shake hands with Hammurabi and take a stroll in the Hanging Gardens?'
' Order our Working Time Machine today!',
provider_token=provider_token,
currency='usd',
photo_url='http://erkelzaar.tsudao.com/models/perrotta/TIME_MACHINE.jpg',
photo_height=512, # !=0/None or picture won't be shown
photo_width=512,
photo_size=512,
is_flexible=False, # True If you need to set up Shipping Fee
prices=100,
start_parameter='time-machine-example',
invoice_payload='HAPPY FRIDAYS COUPON')
如果你使用 price=100 或其他你必须使用的是错误的:
prices = [types.LabeledPrice(label='Working Time Machine', amount=get_amount(basket))]
我是第一次使用支付系统,我无法发送,它给出了这个错误:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/m1rsadikov/tele-bot/venv/lib/python3.8/site-packages/telebot/__init__.py", line 2140, in send_invoice
result = apihelper.send_invoice(
File "/home/m1rsadikov/tele-bot/venv/lib/python3.8/site-packages/telebot/apihelper.py", line 1353, in send_invoice
'prices': _convert_list_json_serializable(prices)}
File "/home/m1rsadikov/tele-bot/venv/lib/python3.8/site-packages/telebot/apihelper.py", line 1597, in _convert_list_json_serializable
for r in results:
TypeError: 'int' object is not iterable
这是我发送的:
bot.send_invoice(message.from_user.id, title='Working Time Machine',
description='Want to visit your great-great-great-grandparents?'
' Make a fortune at the races?'
' Shake hands with Hammurabi and take a stroll in the Hanging Gardens?'
' Order our Working Time Machine today!',
provider_token=provider_token,
currency='usd',
photo_url='http://erkelzaar.tsudao.com/models/perrotta/TIME_MACHINE.jpg',
photo_height=512, # !=0/None or picture won't be shown
photo_width=512,
photo_size=512,
is_flexible=False, # True If you need to set up Shipping Fee
prices=100,
start_parameter='time-machine-example',
invoice_payload='HAPPY FRIDAYS COUPON')
如果你使用 price=100 或其他你必须使用的是错误的:
prices = [types.LabeledPrice(label='Working Time Machine', amount=get_amount(basket))]