# MulenPay API Client
## Описание
Асинхронный Python-клиент для работы с API MulenPay. Подходит для управления платежами и подписками.
## Установка
```bash
pip install pydantic==2.9.2
pip install httpx==0.27.2
pip install mulenpay-api
```
Использование
Настройка клиента
Для начала работы создайте экземпляр Payment или Subscribe, указав ваш api_key и secret_key.
```python
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)
```
# **Работа с платежами**
Создание платежа
```python
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())
```
Получение списка платежей
```python
async def get_list():
response = await payment.get_payment_list()
print(response)
if __name__ == '__main__':
asyncio.run(get_list())
```
Получение платежа по ID
```python
async def get_by_id():
response = await payment.get_payment_by_id(5)
print(response)
if __name__ == '__main__':
asyncio.run(get_by_id())
```
Подтверждение платежа
```python
async def confirm_payment():
response = await payment.confirm_payment(5)
print(response)
if __name__ == '__main__':
asyncio.run(confirm_payment())
```
Отмена платежа
```python
async def cancel_payment():
response = await payment.cancel_payment(5)
print(response)
if __name__ == '__main__':
asyncio.run(cancel_payment())
```
Возврат платежа
```python
async def refund_payment():
response = await payment.refund_payment(5)
print(response)
if __name__ == '__main__':
asyncio.run(refund_payment())
```
# **Работа с подписками**
Получение списка подписок
```python
async def get_subscription_list():
response = await subscribe.get_subscription_list()
print(response)
if __name__ == '__main__':
asyncio.run(get_subscription_list())
```
Удаление подписки по ID
```python
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
Raw data
{
"_id": null,
"home_page": null,
"name": "mulenpay-api",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "payment Mulen Pay wallex",
"author": "WALLEXFINTECH",
"author_email": "platem9@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/04/9b/474bf2f4efc3614ca88f1e0c39b9b355a97227b189f9f956ed26edc61944/mulenpay_api-1.0.12.tar.gz",
"platform": null,
"description": "# MulenPay API Client\n\n## \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\n\n\u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 Python-\u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 API MulenPay. \u041f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043b\u0430\u0442\u0435\u0436\u0430\u043c\u0438 \u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430\u043c\u0438.\n\n## \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430\n\n```bash\npip install pydantic==2.9.2\npip install httpx==0.27.2\npip install mulenpay-api\n```\n\n\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\n\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\n\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 Payment \u0438\u043b\u0438 Subscribe, \u0443\u043a\u0430\u0437\u0430\u0432 \u0432\u0430\u0448 api_key \u0438 secret_key.\n\n```python\nfrom mulenpay_api import Payment\nfrom mulenpay_api.subscribe import Subscribe\n\napi_key = '\u0412\u0410\u0428_API_KEY'\nsecret_key = '\u0412\u0410\u0428_SECRET_KEY'\n\npayment = Payment(api_key=api_key, secret_key=secret_key)\nsubscribe = Subscribe(api_key=api_key)\n```\n# **\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043f\u043b\u0430\u0442\u0435\u0436\u0430\u043c\u0438**\n\n\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043b\u0430\u0442\u0435\u0436\u0430\n```python\nimport asyncio\n\nasync def create_payment():\n response = await payment.create_payment(payment.CreatePayment(\n currency=\"rub\",\n amount=\"1000.50\",\n uuid=\"invoice_123\",\n shopId=5,\n description=\"\u041f\u043e\u043a\u0443\u043f\u043a\u0430 \u0431\u0443\u043b\u043e\u0447\u0435\u043a\",\n subscribe=None,\n holdTime=None\n ))\n print(response)\n\nif __name__ == '__main__':\n asyncio.run(create_payment())\n```\n\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439\n```python\nasync def get_list():\n response = await payment.get_payment_list()\n print(response)\n\nif __name__ == '__main__':\n asyncio.run(get_list())\n```\n\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u043b\u0430\u0442\u0435\u0436\u0430 \u043f\u043e ID\n```python\nasync def get_by_id():\n response = await payment.get_payment_by_id(5)\n print(response)\n\nif __name__ == '__main__':\n asyncio.run(get_by_id())\n```\n\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u043b\u0430\u0442\u0435\u0436\u0430\n```python\nasync def confirm_payment():\n response = await payment.confirm_payment(5)\n print(response)\n\nif __name__ == '__main__':\n asyncio.run(confirm_payment())\n```\n\u041e\u0442\u043c\u0435\u043d\u0430 \u043f\u043b\u0430\u0442\u0435\u0436\u0430\n```python\nasync def cancel_payment():\n response = await payment.cancel_payment(5)\n print(response)\n\nif __name__ == '__main__':\n asyncio.run(cancel_payment())\n```\n\u0412\u043e\u0437\u0432\u0440\u0430\u0442 \u043f\u043b\u0430\u0442\u0435\u0436\u0430\n```python\nasync def refund_payment():\n response = await payment.refund_payment(5)\n print(response)\n\nif __name__ == '__main__':\n asyncio.run(refund_payment())\n```\n# **\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430\u043c\u0438**\n\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u043e\u043a\n```python\nasync def get_subscription_list():\n response = await subscribe.get_subscription_list()\n print(response)\n\nif __name__ == '__main__':\n asyncio.run(get_subscription_list())\n```\n\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438 \u043f\u043e ID\n```python\nasync def delete_subscription():\n response = await subscribe.delete_subscription_by_id(5)\n print(response)\n\nif __name__ == '__main__':\n asyncio.run(delete_subscription())\n```\n# \u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\n-Python 3.7+\n\n-\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 mulenpay-api\n",
"bugtrack_url": null,
"license": null,
"summary": "\u041f\u0440\u0438\u0435\u043c \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439 \u0438 \u0432\u044b\u043f\u043b\u0430\u0442\u044b \u0447\u0435\u0440\u0435\u0437 Mulen Pay",
"version": "1.0.12",
"project_urls": {
"Documentation": "https://mulenpay.ru/docs/api"
},
"split_keywords": [
"payment",
"mulen",
"pay",
"wallex"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "049b474bf2f4efc3614ca88f1e0c39b9b355a97227b189f9f956ed26edc61944",
"md5": "726d2b058d7c4c5318bc25f565e4a49b",
"sha256": "9e19d91ebb43a958c51a6bb485238725e169daacd92c28e818c7fc3b2d7330fe"
},
"downloads": -1,
"filename": "mulenpay_api-1.0.12.tar.gz",
"has_sig": false,
"md5_digest": "726d2b058d7c4c5318bc25f565e4a49b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 4237,
"upload_time": "2024-12-03T03:23:55",
"upload_time_iso_8601": "2024-12-03T03:23:55.839996Z",
"url": "https://files.pythonhosted.org/packages/04/9b/474bf2f4efc3614ca88f1e0c39b9b355a97227b189f9f956ed26edc61944/mulenpay_api-1.0.12.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-03 03:23:55",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "mulenpay-api"
}