Skip to main content

Прием платежей и выплаты через Mulen Pay

Project description

MulenPay API Client

Описание

Асинхронный Python-клиент для работы с API MulenPay. Подходит для управления платежами и подписками.

Установка

pip install pydantic==2.9.2
pip install httpx==0.27.2
pip install mulenpay-api

Использование Настройка клиента Для начала работы создайте экземпляр Payment или Subscribe, указав ваш api_key и secret_key.

from mulenpay_api import Payment
from mulenpay_api.subscribe import Subscribe

api_key = 'ВАШ_API_KEY'
secret_key = 'ВАШ_SECRET_KEY'

payment = Payment(api_key=api_key, secret_key=secret_key)
subscribe = Subscribe(api_key=api_key)

Работа с платежами

Создание платежа

import asyncio

async def create_payment():
    response = await payment.create_payment(payment.CreatePayment(
        currency="rub",
        amount="1000.50",
        uuid="invoice_123",
        shopId=5,
        description="Покупка булочек",
        subscribe=None,
        holdTime=None
    ))
    print(response)

if __name__ == '__main__':
    asyncio.run(create_payment())

Получение списка платежей

async def get_list():
    response = await payment.get_payment_list()
    print(response)

if __name__ == '__main__':
    asyncio.run(get_list())

Получение платежа по ID

async def get_by_id():
    response = await payment.get_payment_by_id(5)
    print(response)

if __name__ == '__main__':
    asyncio.run(get_by_id())

Подтверждение платежа

async def confirm_payment():
    response = await payment.confirm_payment(5)
    print(response)

if __name__ == '__main__':
    asyncio.run(confirm_payment())

Отмена платежа

async def cancel_payment():
    response = await payment.cancel_payment(5)
    print(response)

if __name__ == '__main__':
    asyncio.run(cancel_payment())

Возврат платежа

async def refund_payment():
    response = await payment.refund_payment(5)
    print(response)

if __name__ == '__main__':
    asyncio.run(refund_payment())

Работа с подписками

Получение списка подписок

async def get_subscription_list():
    response = await subscribe.get_subscription_list()
    print(response)

if __name__ == '__main__':
    asyncio.run(get_subscription_list())

Удаление подписки по ID

async def delete_subscription():
    response = await subscribe.delete_subscription_by_id(5)
    print(response)

if __name__ == '__main__':
    asyncio.run(delete_subscription())

Требования

-Python 3.7+

-Установленная библиотека mulenpay-api

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mulenpay_api-1.0.12.tar.gz (4.2 kB view details)

Uploaded Source

File details

Details for the file mulenpay_api-1.0.12.tar.gz.

File metadata

  • Download URL: mulenpay_api-1.0.12.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.6

File hashes

Hashes for mulenpay_api-1.0.12.tar.gz
Algorithm Hash digest
SHA256 9e19d91ebb43a958c51a6bb485238725e169daacd92c28e818c7fc3b2d7330fe
MD5 726d2b058d7c4c5318bc25f565e4a49b
BLAKE2b-256 049b474bf2f4efc3614ca88f1e0c39b9b355a97227b189f9f956ed26edc61944

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page