Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oreg0na/wallet_pay
https://github.com/oreg0na/wallet_pay
api payment telegram telegram-bot wallet-api
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/oreg0na/wallet_pay
- Owner: oreg0na
- Created: 2023-11-27T21:40:53.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-03T20:46:35.000Z (about 1 year ago)
- Last Synced: 2023-12-03T21:28:00.046Z (about 1 year ago)
- Topics: api, payment, telegram, telegram-bot, wallet-api
- Language: Python
- Homepage:
- Size: 52.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Wallet Pay API (Python)
https://docs.wallet.tg/pay/## Installation
```commandline
pip install walletpay
```## Example
```python
import asynciofrom uuid import uuid4
from aiogram import Bot
from aiogram.types import InlineKeyboardButton, InlineKeyboardMarkupfrom walletpay import Client
CUSTOMER_TELEGRAM_ID = 133777888
async def main():
api = Client("YoUrApIKey")
bot = Bot("1294789:YourBoTKey")# Create order
order = await api.create_order(
"0.001",
external_id=str(uuid4()),
customer_telegram_user_id=CUSTOMER_TELEGRAM_ID,
description="Support me",
timeout_seconds=60,
)# Send order to user
await bot.send_message(
CUSTOMER_TELEGRAM_ID,
"Pay",
reply_markup=InlineKeyboardMarkup(
inline_keyboard=[
[
InlineKeyboardButton(
text="👛 Pay via Wallet",
url=order.data.payLink,
)
]
]
)
)await api.session.close()
await bot.session.close()asyncio.run(main())
```## Requirements
1. Python >= 3.11## Running tests
1. Clone
2. Install with dev dependencies
```commandline
poetry install --with dev
```
3. From the root dir run
```commandline
pytest tests
```## Running examples
1. Clone repo
2. Run `poetry install --group examples`
3. Add env vars:
3.1 Add WP_TEST_KEY with your API key
3.2 (FOR bot.py) Add WP_BOT_TOKEN with bot token bound to your api
4. Go to examples folder and run them like regular python scripts### Note about webhooks example
WARNING! For development purposes only!
To run webhook example you need dedicated IP address
You can use ngrok to test your application:
1. Download ngrok and log in
2. Run `ngrok http 80`
3. Copy your temporary IP address
4. Paste it in your merchant settings
5. !AFTER DEVELOPMENT DON'T FORGET TO REMOVE ADDRESS IN WALLETPAY WEBHOOK SETTINGS PROVIDED FROM NGROK!