我们决定使用机器人连接通过 Yandex Cashier 接受付款。而我们遇到了这样一个问题:在测试的时候,支付速度非常快,秒级,而当你连接商店的时候,用户超时卡住,并且支付经常在商店中不显示。如果有人有通过电报机器人连接支付的经验,你能告诉我可能出了什么问题吗?
@bot.message_handler(commands=['start'])
def start_message(message):
keyboard = telebot.types.InlineKeyboardMarkup()
keyboard.row(types.InlineKeyboardButton('Начать оплату', callback_data='start_payment'))
bot.send_photo(message.chat.id, 'https://drive.google.com/open?id=10Ez-WV5_55Kc2MoMPA88elkKtIBWRj6D')
bot.send_message(message.chat.id, 'Нажмите, чтобы начать оплату:', reply_markup=keyboard)
@bot.callback_query_handler(lambda call: call.data == 'start_payment')
def start_payment(call):
tg_id = call.message.chat.id
bot.send_message(tg_id,
'''
Use this test card number to pay for your Item:
1111 1111 1111 1026
Expiration Date: 12/22
CVC: 000
'''
)
bot.send_invoice(tg_id, title='Item for Sale',
description='Bla-Bla-Bla',
provider_token=live_payment_token, # ТЕСТОВЫЙ ТОКЕН (TEST) РАБОТАЕТ, А ВОТ С LIVE ПОСТОЯННО ГЛЮЧИТ
currency='RUB',
photo_url=None,
need_phone_number=False,
need_email=False,
is_flexible=False, # True If you need to set up Shipping Fee
prices=[LabeledPrice(label='Item_Name', amount=250000)],
start_parameter='start_parameter',
invoice_payload='coupon')
@bot.pre_checkout_query_handler(func=lambda query: True)
def checkout(query):
print(query)
bot.answer_pre_checkout_query(query.id, ok=True)
@bot.message_handler(content_types=['successful_payment'])
def got_payment(message):
# print(message)
tg_id = message.chat.id
bot.send_message(tg_id,'Ваш платеж успешно дошел, спасибо за оплату!')
该问题已自行解决,需要等待 Yandex.Checkout 对商店的确认,否则 LIVE 令牌不起作用。