No project description provided
Project description
Wallet Pay Python API
Installation
pip install walletpay-sdk
Example
import asyncio
from uuid import uuid4
from aiogram import Bot
from aiogram.types import InlineKeyboardButton, InlineKeyboardMarkup
from 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
- Python >= 3.11
Running tests
- Clone repo
- From the root dir run
pytest tests
Running examples
- Clone repo
- Run
poetry install --group examples - 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 - 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:
- Download ngrok and log in
- Run
ngrok http 80 - Copy your temporary IP address
- Paste it in your merchant settings
- !AFTER DEVELOPMENT DON'T FORGET TO REMOVE ADDRESS IN WALLETPAY WEBHOOK SETTINGS PROVIDED FROM NGROK!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
walletpay_sdk-1.1.3.tar.gz
(7.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file walletpay_sdk-1.1.3.tar.gz.
File metadata
- Download URL: walletpay_sdk-1.1.3.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b04cef95bde5326ed540f7d219733bfd527657922531fb1751cc083fc1ab774b
|
|
| MD5 |
46d802c1696f16fdd05203fbdbdad5ef
|
|
| BLAKE2b-256 |
d00488b752ea02e1c849b4bcd22fa629c3e547bc6c5d38137e8e2f8fd65d670c
|
File details
Details for the file walletpay_sdk-1.1.3-py3-none-any.whl.
File metadata
- Download URL: walletpay_sdk-1.1.3-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e901fecbf0dd3f1f01e2b77fd95cee455600caeb489d4913edaa084077d76fd
|
|
| MD5 |
89b8ef399fde50fa7b8da049b357120b
|
|
| BLAKE2b-256 |
565c6e77d13bb3ad004de2b0919d3970f2c0377ebfda0189c2be376f644d0907
|