Привет! Вот код на Python магазин в Telegram, принимающий оплату через QIWI и выдающий товар при поступлении денег на QIWI.
```python
import telebot
from telebot import types
from qiwi_payments import Qiwi
TOKEN = '<YOUR_TELEGRAM_BOT_TOKEN>'
QIWI_TOKEN = '<YOUR_QIWI_TOKEN>'
QIWI_WALLET = '<YOUR_QIWI_WALLET>'
QIWI_CALLBACK_URL = '<YOUR_QIWI_CALLBACK_URL>'
QIWI_SECRET_KEY = '<YOUR_QIWI_SECRET_KEY>'
bot = telebot.TeleBot(TOKEN)
qiwi = Qiwi(token=QIWI_TOKEN, secret_key=QIWI_SECRET_KEY)
@bot.message_handler(commands=['start'])
def start(message):
markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
item1 = types.KeyboardButton('Buy')
markup.add(item1)
bot.send_message(message.chat.id, "Welcome to the store!", reply_markup=markup)
@bot.message_handler(func=lambda message: True)
def handle_message(message):
if message.text == 'Buy':
invoice = qiwi.create_invoice(amount=100, currency='RUB', comment='Payment for the item', expiration_date=3600)
payment_url = invoice['payUrl']
bot.send_message(message.chat.id, f"Please proceed with the payment by following this link: {payment_url}")
@qiwi.bill_paid
def on_payment_received(bill_id, amount):
# Process the payment and deliver the item
bot.send_message(message.chat.id, f"Payment received! Your item will be delivered shortly.")
qiwi.start_polling()
bot.polling()
```
Обрати внимание, что для работы этого кода необходимо установить библиотеки `telebot` и `qiwi_payments`
.