A simple and unofficial SDK for the Platega.io API.
Project description
🟢 Platega SDK (Unofficial)
🛠️ A simple and unofficial Python SDK for the Platega.io API.
Provides convenient methods to create transactions, fetch statuses, and get rates.
✨ Features
- Minimalistic and clean API wrapper
- Built-in request/response validation with Pydantic
- Proper error handling with custom exceptions
- Supports Python 3.8+
📦 Installation
pip install plategaio
🚀 Quick Start
from plategaio import PlategaClient, CreateTransactionRequest, PaymentDetails
from uuid import uuid4
# init client
client = PlategaClient(
merchant_id="YOUR_MERCHANT_ID",
secret="YOUR_SECRET_KEY",
)
# create a transaction
tx = client.create_transaction(
CreateTransactionRequest(
paymentMethod=2,
id=uuid4(),
paymentDetails=PaymentDetails(amount=100.0, currency="RUB"),
description="test order",
return_url="https://your.site/success", # put your link after success payment
failedUrl="https://your.site/failed", # put your link after failed payment
)
)
print("Redirect user to:", tx.redirect)
# get transaction status
status = client.get_transaction_status(tx.transactionId)
print("Transaction status:", status.status)
# get conversion rate
rate = client.get_rate(payment_method=2, currency_from="USDT", currency_to="RUB")
print("USDT Rate:", rate.rate)
⚠️ Error Handling
SDK raises custom exceptions:
PlategaError– Base exceptionPlategaHTTPError– Non-200 API response
Example:
from plategaio import PlategaHTTPError
try:
tx = client.create_transaction(...)
except PlategaHTTPError as e:
print(f"Request failed: {e.status_code} {e.message}")
📚 API Reference
PlategaClient
create_transaction(payload: CreateTransactionRequest) -> CreateTransactionResponseget_transaction_status(transaction_id: str) -> TransactionStatusResponseget_rate(payment_method: int, currency_from: str, currency_to: str, merchant_id: Optional[str] = None) -> RateResponse
🌍 Links
- 📦 PyPI
- 💻 Source Code
- 🔗 Platega.io
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
plategaio-1.0.0.tar.gz
(3.5 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 plategaio-1.0.0.tar.gz.
File metadata
- Download URL: plategaio-1.0.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f81bfbd6994d8c12508ac742dbab5f952bdab8ba2776d980001465ffb7724c94
|
|
| MD5 |
f640049330410a8ed699b7804babc380
|
|
| BLAKE2b-256 |
94f89210fd124c6e2f95bee37b98ae0123a3702e0a5567235fa9525fad5b04e4
|
File details
Details for the file plategaio-1.0.0-py3-none-any.whl.
File metadata
- Download URL: plategaio-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65fe504428136c1ce757cc7cb60e4b3f4fd657f64adb8c351da745d100747a4c
|
|
| MD5 |
43662672be1fe17416cb7c834ebbdffd
|
|
| BLAKE2b-256 |
b84872d6726431168a98899252d6290a90d7e6f22e72a716c546c80deee22b0b
|