Skip to content

Create SteamWallet #4876

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions SteamWallet
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import telegram
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters

TOKEN = "Here is the token for bot Admin @SafeSteamPay_Bot:

8395208886:AAEkdnINd5YzS6BlDhJFZ6TizeOyvwfK_JA"
PAYMENT_PROVIDER_TOKEN = "YOOKASSA_OR_OTHER_PROVIDER_TOKEN"

def start(update, context):
update.message.reply_text("Добро пожаловать! Используйте /topup для пополнения Steam.")

def topup(update, context):
chat_id = update.message.chat_id
title = "Пополнение Steam"
description = "Пополните баланс Steam на 100 руб"
payload = "steam-topup-10usd"
currency = "руб"
price = 1000 # в центах/копейках
prices = [telegram.LabeledPrice("100 руб", price)]

context.bot.send_invoice(
chat_id, title, description, payload,
PAYMENT_PROVIDER_TOKEN, currency, prices
)

def handle_precheckout(update, context):
query = update.pre_checkout_query
if query.invoice_payload != "steam-topup-100руб":
query.answer(ok=False, error_message="Ошибка платежа.")
else:
query.answer(ok=True)

def handle_payment(update, context):
# Выдать Steam-код после оплаты
update.message.reply_text("Платеж успешен! Ваш код: XXXXX-XXXXX-XXXXX")

updater = Updater(TOKEN, use_context=True)
dp = updater.dispatcher

dp.add_handler(CommandHandler("start", start))
dp.add_handler(CommandHandler("topup", topup))
dp.add_handler(MessageHandler(Filters.successful_payment, handle_payment))
dp.add_handler(PreCheckoutQueryHandler(handle_precheckout))

updater.start_polling()
updater.idle()
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy