Answer the question
In order to leave comments, you need to log in
How can I bill for 15 minutes?
The bot bills for 5 hours, 15, etc., but for some reason does not want to 15 minutes or less and gives an error:
please modify your request according to API specification; Cause: unknown please modify your request according to API specification; Cause: unknown
@dp.message_handler(commands=['pay_qiwi_1'])
async def buy(message: types.Message):
global bill
price = 150
lifetime = 100
random_id = random.random()
comment = f'ID: {message.from_user.id}, NAME: {message.from_user.first_name} {message.from_user.last_name}, USERNAME: {message.from_user.username}'
bill = p2p.bill(bill_id=random_id, amount=price, lifetime=lifetime, comment=comment)
await bot.send_message(message.from_user.id, f'<a href="{bill.pay_url}">Ссылка на оплату Qiwi {price} р.</a>')
x = threading.Thread(target=functionoplata, args=(message,))
x.start()
def functionoplata(message):
oplata_time = datetime.datetime.now()
datetime_delta = oplata_time + timedelta(minutes=15)
while True:
status = p2p.check(bill_id=bill.bill_id).status
if status == 'PAID':
chat_id = message.from_user.id
balance = int(1)
db.addBalance(message.from_user.id, balance)
pay_result = "На ваш счет зачислен 1 запрос"
requests.post(f"https://api.telegram.org/bot2140672186:AAGWMIR00YzbtVcDv_TkLQscxary_Gtq79U/sendMessage?chat_id={chat_id}&text={pay_result}").json()
break
elif datetime.datetime.now() > datetime_delta:
chat_id = message.from_user.id
pay_result = "Срок действия ссылки закончился!"
requests.post(f"https://api.telegram.org/bot2140672186:AAGWMIR00YzbtVcDv_TkLQscxary_Gtq79U/sendMessage?chat_id={chat_id}&text={pay_result}").json()
break
time.sleep(0.1)
pyqiwip2p
Answer the question
In order to leave comments, you need to log in
Validation error, please modify your request according to API specification; Cause: unknown. {'expirationDateTime': ['must be a future date']}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question