pip install yoomoney
from yoomoney import Authorize
Authorize(
client_id="YOUR_CLIENT_ID", # client_id полученный при регистрации приложения (B7598786A657D9CB4F455468BE00C2BD1590A07453456784F85133098E0D9)
redirect_uri="YOUR_REDIRECT_URI", # redirect_uri указанный при регистрации приложения (https://lozerix.com/)
scope=["account-info","operation-history","operation-details","incoming-transfers","payment-p2p","payment-shop",])
Visit this website and confirm the application authorization request:
https://yoomoney.ru/oauth2/authorize?requestid=31363837375f66373393230653537646630626538643437643163313632
Enter redirected url (https://yourredirect_uri?code=XXXXXXXXXXXXX) or just code:
from yoomoney import Client, Quickpay
token = "4900668167177708.8DAA1D1DD1B71256721C3C84783830FC8019948BB55F8C16D144DCC9FF4A31EB4D3D91F15C2606B97B6B4BE8D9C4B85B9DADFC21E4957A79E584CBB1762E16C634089911EFF29D3B676DA840A6FBE18A"
client = Client(token)
quickpay = Quickpay(receiver="4900668167177708",quickpay_form="shop",targets="Sponsor this project",paymentType="SB",sum="Сумма пополнения",label="Уникальный комментарий плательщика"
url = quickpay.redirected_url
async def check_pay(message, comment):
try:
history = client.operation_history(label=str(comment))
if history.operations == []:
await main.bot.send_message(message.chat.id, f"⚜️Сожалеем но платеж не был обнаружен...")
else:
for operation in history.operations:
if operation.status == 'success':
pass
except Exception as e:
print(e)
check_pay
Можно айди пользователя запихнуть в label, он же у всех разныйлучше к каждому вызову новые комменты создавать