aiocloudpayments
Python Async CloudPayments Library
Client Basic Usage Example
from datetime import date
from aiocloudpayments import AioCpClient
async def main():
client = AioCpClient(PUBLIC_ID, API_SECRET)
await client.test()
await client.charge_card(
amount=10,
currency="RUB",
invoice_id="1234567",
ip_address="123.123.123.123",
description="Payment for goods in example.com",
account_id="user_x",
name="CARDHOLDER NAME",
card_cryptogram_packet="01492500008719030128SMfLeYdKp5dSQVIiO5l6ZCJiPdel4uDjdFTTz1UnXY+3QaZcNOW8lmXg0H670MclS4lI+qLkujKF4pR5Ri+T/E04Ufq3t5ntMUVLuZ998DLm+OVHV7FxIGR7snckpg47A73v7/y88Q5dxxvVZtDVi0qCcJAiZrgKLyLCqypnMfhjsgCEPF6d4OMzkgNQiynZvKysI2q+xc9cL0+CMmQTUPytnxX52k9qLNZ55cnE8kuLvqSK+TOG7Fz03moGcVvbb9XTg1oTDL4pl9rgkG3XvvTJOwol3JDxL1i6x+VpaRxpLJg0Zd9/9xRJOBMGmwAxo8/xyvGuAj85sxLJL6fA==",
payer=Person(
first_name="Test",
last_name="Test",
middle_name="Test",
birth=date(1998, 1, 16),
address="12A, 123",
street="Test Avenue",
city="LosTestels, City of Test Angels",
country="Testland",
phone="+1 111 11 11",
post_code="101011010"
)
)
await client.disconnect()
AiohttpDispatcher Basic Usage Example
from aiocloudpayments import AiohttpDispatcher, Result
from aiocloudpayments.types import PayNotification, CancelNotification, CheckNotification
CERT_FILE = "cert.pem"
CERT_FILE = "pkey.pem"
def main():
dp = AiohttpDispatcher()
# router is not needed here, but I am just showing the logic
router = Router()
# register with router
@router.cancel(lambda n: 5 > n.amount > 1)
async def foo(notification: CancelNotification):
print(f"{notification=}")
# return {"result": 0}
return Result.OK
# register with router
@router.pay(lambda n: n.amount <= 1)
async def foo(notification: PayNotification):
print(f"{notification.amount=}")
# return {"result": 0}
return Result.OK
# register with router
@router.check()
async def foo(notification: CheckNotification):
print(f"{notification.amount=}")
# return {"result": 12}
return Result.WRONG_AMOUNT
# register with dp
@dp.cancel(lambda n: n.amount > 5)
async def foo(notification: CancelNotification):
print(f"{notification.amount=}, > 5")
# if you don't return anything, Result.OK is assumed
dp.include_router(router)
ssl_context = SSLContext()
ssl_context.load_cert_chain(CERT_FILE, KEY_FILE)
dp.run_app(
AioCpClient(PUBLIC_ID, API_SECRET),
"/test",
pay_path="/pay",
cancel_path="/cancel",
ssl_context=ssl_context,
check_hmac=False # disable hmac check, only use in development environments
)
architecture inspired by aiogram
Metadata
Release files for aiocloudpayments 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aiocloudpayments-0.1.1.tar.gz | 17.1 kB | Without provenance | Details for aiocloudpayments-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aiocloudpayments-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for aiocloudpayments-0.1.1-py3-none-any.whl |
Total release size: 57.5 kB
Release files / aiocloudpayments-0.1.1.tar.gz
| Download URL | aiocloudpayments-0.1.1.tar.gz |
|---|---|
| Size | 17.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2b423a117eff3513d4228a1c2bc4d0deef41c38b15913234c5bfc0469ec77ded
|
|
BLAKE2b-256 checksum How to use checksums |
9e79d284047b615a81ca0b3cd2a22fe10970152641e173445d0def81077c32bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.10.6 Windows/10
|
Release files / aiocloudpayments-0.1.1-py3-none-any.whl
| Download URL | aiocloudpayments-0.1.1-py3-none-any.whl |
|---|---|
| Size | 40.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0f49f846076efb1be8a06116269848d0482085cf50882d16e751c7ee45ffe8fc
|
|
BLAKE2b-256 checksum How to use checksums |
d3fa612170c2af0f9225837d6bece4f3a521e73dd96408acddba43c564486398
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.10.6 Windows/10
|
Security for aiocloudpayments 0.1.1
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.