Official Python SDK for the tiqopay API — escrow payments for Morocco
Project description
tiqopay — official Python SDK
Escrow payments for Morocco. The SDK mirrors @tiqopay/sdk (Node) one-for-one — same resources, same field names, same retry behavior — so polyglot teams can move between languages without re-learning the API.
Install
pip install tiqopay
Requires Python 3.9+. Zero runtime dependencies — uses stdlib urllib and hmac only.
Quickstart
from tiqopay import Tiqopay
client = Tiqopay(api_key="sk_test_...")
txn = client.transactions.create(
amount=50000, # 500.00 MAD in centimes
description="Logo design",
seller={"email": "seller@example.ma"},
buyer={"email": "buyer@example.ma"},
delivery_deadline_days=7,
)
print(txn["payment_url"])
Webhook verification
import os
from tiqopay.webhooks import verify_webhook, WebhookVerificationError
# FastAPI / Starlette example
@app.post("/webhooks/tiqopay")
async def handle(request: Request):
body = await request.body()
try:
event = verify_webhook(
payload=body,
signature=request.headers.get("tiqopay-signature"),
secret=os.environ["WEBHOOK_SECRET"],
)
except WebhookVerificationError:
return Response(status_code=400)
if event["type"] == "transaction.funded":
...
return {"received": True}
Pass the raw request body — any re-serialization breaks the signature. The verifier handles secret-rotation overlaps automatically.
Resources
| Resource | Methods |
|---|---|
client.account |
retrieve() |
client.transactions |
create, list, retrieve, deliver, dispute, refund, cancel |
client.payment_links |
create, list, retrieve, update, delete |
client.webhook_endpoints |
create, list, retrieve, delete |
client.events |
list, retrieve |
client.payouts |
list, retrieve |
client.notifications |
list, retrieve, update, mark_all_read |
Escrow release is intentionally not exposed. Funds are released by the buyer (via the confirm-receipt link) or automatically 48 h after delivery — not by the seller. See the API docs for the full rationale.
Errors
from tiqopay import TiqopayError
try:
client.transactions.retrieve("txn_nope")
except TiqopayError as err:
print(err.status, err.code, err.message)
err.status == 0 means a transport-level failure (DNS, timeout, TLS) after the retry budget. Everything else is an HTTP status from the API; see the error catalog for err.code recovery guidance.
Configuration
Tiqopay(
api_key="sk_test_...",
base_url="https://tiqopay.com/api", # override only for local dev
timeout=30, # per-request seconds
max_retries=3, # 429 / 5xx, exponential backoff
)
The SDK pins Tiqopay-Version: 2026-04-18 on every request. Upgrading the package is what opts you into a newer API version — backend defaults never shift behavior under you.
License
MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 tiqopay-1.0.0.tar.gz.
File metadata
- Download URL: tiqopay-1.0.0.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d735fbe5fe5bb94dde842e7c530038acfb893e2c8dcbb6f3562f653ef206de4
|
|
| MD5 |
662786ec5ea7debc9ae1542b876d64b6
|
|
| BLAKE2b-256 |
2dba2155f64d749798ea29451a821a84d0fb1371dffe27f1e32694b764a4d743
|
File details
Details for the file tiqopay-1.0.0-py3-none-any.whl.
File metadata
- Download URL: tiqopay-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.8 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 |
b855ef816fec414800657815c910b228ef9c56dd30bf54d01b33317cb369bdd6
|
|
| MD5 |
6693a720186417cf656129c5bb2d7f58
|
|
| BLAKE2b-256 |
e0c722ccb2a70f7c1856e77d8493a98dd38c58cd7dfaa7238b0e60d71c092731
|