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-0.1.0.tar.gz
(3.4 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-0.1.0.tar.gz.
File metadata
- Download URL: plategaio-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b1a42e6191f3c43849b43bbdfa611d4339d17e55cf4de81eab3b3025ff5754c
|
|
| MD5 |
907b93c232316153223f0d92ab533635
|
|
| BLAKE2b-256 |
6aef987d76a2eb2f81d6d2555cff005a9d4c949eb85cdcd7b8f3b71f3e6c8f06
|
File details
Details for the file plategaio-0.1.0-py3-none-any.whl.
File metadata
- Download URL: plategaio-0.1.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.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e7fe48f03f3f88dd1047853a329cab588adb6152d3796f093dd3a8e126e4630
|
|
| MD5 |
f5d1b0c0a361a61533473db112b3241c
|
|
| BLAKE2b-256 |
c909d9218b8688d98e1b19fa90b0dc1b41e6e5eebee46de61130ba79b6f0948c
|