Skip to main content

Wallet Pay Python API

https://docs.wallet.tg/pay/

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

  1. Python >= 3.11

Running tests

  1. Clone repo
  2. From the root dir run
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!

Metadata

Release files for walletpay-sdk 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for walletpay-sdk 1.1.3
File Size Uploaded Provenance Actions
walletpay_sdk-1.1.3.tar.gz 7.3 kB Without provenance Details for walletpay_sdk-1.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for walletpay-sdk 1.1.3
File Interpreter ABI Platform Actions
walletpay_sdk-1.1.3-py3-none-any.whl Python 3 none any Details for walletpay_sdk-1.1.3-py3-none-any.whl

Total release size: 20.7 kB

Release files / walletpay_sdk-1.1.3.tar.gz

Download URL walletpay_sdk-1.1.3.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b04cef95bde5326ed540f7d219733bfd527657922531fb1751cc083fc1ab774b
BLAKE2b-256 checksum
How to use checksums
d00488b752ea02e1c849b4bcd22fa629c3e547bc6c5d38137e8e2f8fd65d670c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / walletpay_sdk-1.1.3-py3-none-any.whl

Download URL walletpay_sdk-1.1.3-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e901fecbf0dd3f1f01e2b77fd95cee455600caeb489d4913edaa084077d76fd
BLAKE2b-256 checksum
How to use checksums
565c6e77d13bb3ad004de2b0919d3970f2c0377ebfda0189c2be376f644d0907
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Security for walletpay-sdk 1.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page