Skip to main content

PayzCore Python SDK

Python client for the PayzCore blockchain transaction monitoring API.

Important

PayzCore is a blockchain monitoring service, not a payment processor. All payments are sent directly to your own wallet addresses. PayzCore never holds, transfers, or has access to your funds.

  • Your wallets, your funds — You provide your own wallet (HD xPub or static addresses). Customers pay directly to your addresses.
  • Read-only monitoring — PayzCore watches the blockchain for incoming transactions and sends webhook notifications. That's it.
  • Protection Key security — Sensitive operations like wallet management, address changes, and API key regeneration require a Protection Key that only you set. PayzCore cannot perform these actions without your authorization.
  • Your responsibility — You are responsible for securing your own wallets and private keys. PayzCore provides monitoring and notification only.

Installation

pip install payzcore

Quick Start

Payment Monitoring

from payzcore import PayzCore

client = PayzCore("pk_live_xxx")

# Create a payment monitoring request (network specified)
response = client.payments.create(
    amount=50,
    external_ref="user-123",
    network="TRC20",
)
payment = response["payment"]
print(f"Send {payment['amount']} {payment['token']} to {payment['address']}")
print(f"Expires at: {payment['expires_at']}")
# Static wallet projects may also return: payment['notice'], payment['original_amount'], payment['requires_txid']

# Or let the customer choose the network on the payment page
response = client.payments.create(
    amount=50,
    external_ref="user-123",
)
p = response["payment"]
print(p["awaiting_network"])    # True
print(p["payment_url"])         # "https://app.payzcore.com/pay/xxx"
print(p["available_networks"])  # [{"network": "TRC20", "name": "Tron", "tokens": ["USDT"]}, ...]

# Create a USDC payment on Polygon
response = client.payments.create(
    amount=100,
    external_ref="order-456",
    network="POLYGON",
    token="USDC",
)

# Create a payment with static wallet (dedicated mode)
response = client.payments.create(
    amount=50,
    external_ref="user-789",
    network="TRC20",
    address="Txxxx...",  # optional, static wallet dedicated mode only
)

# List payments
payments = client.payments.list(status="pending", limit=10)
for p in payments["payments"]:
    print(f"{p['id']}: {p['status']} ({p['expected_amount']} {p['token']})")
print(payments["pagination"]["has_more"])  # True if there is another page

# Poll for changes (webhook fallback): payments updated since a timestamp
changed = client.payments.list(updated_after="2026-10-15T00:00:00Z")

# Get payment details (latest cached status from database)
detail = client.payments.get("payment-uuid")
print(f"Status: {detail['payment']['status']}")
for tx in detail["payment"]["transactions"]:
    print(f"  TX: {tx['tx_hash']} - {tx['amount']} {detail['payment']['token']}")

# Cancel a pending payment
result = client.payments.cancel("payment-uuid")
# result["payment"]["status"] == "cancelled"

# Submit tx hash for verification (pool + txid mode)
result = client.payments.confirm("payment-uuid", "abc123def456...")
# result["verified"], result["status"], result["amount_received"]

Supported Networks and Tokens

Network Blockchain Tokens
TRC20 Tron USDT
BEP20 BNB Smart Chain USDT, USDC
ERC20 Ethereum USDT, USDC
POLYGON Polygon USDT, USDC
ARBITRUM Arbitrum USDT, USDC

The token parameter defaults to "USDT" if not specified, ensuring backward compatibility.

Project Management (Admin)

from payzcore import PayzCore

admin = PayzCore("mk_xxx", master_key=True)

# Create a project
project = admin.projects.create(
    name="My Store",
    slug="my-store",
    webhook_url="https://example.com/webhooks/payzcore",
)
print(f"API Key: {project['project']['api_key']}")

# List projects
projects = admin.projects.list()
for p in projects["projects"]:
    print(f"{p['name']} ({p['slug']}): {'active' if p['is_active'] else 'inactive'}")

Webhook Verification

from payzcore import verify_signature, construct_event, WebhookSignatureError

# In your webhook handler
def handle_webhook(request):
    body = request.body.decode("utf-8")
    signature = request.headers["X-PayzCore-Signature"]
    timestamp = request.headers["X-PayzCore-Timestamp"]
    secret = "whsec_xxx"  # From project creation

    try:
        event = construct_event(body, signature, secret, timestamp=timestamp)
    except WebhookSignatureError:
        return {"error": "Invalid signature"}, 401

    if event["event"] == "payment.completed":
        print(f"Payment {event['payment_id']} completed!")
        print(f"Amount: {event['paid_amount']} {event['token']} on {event['network']}")

    return {"ok": True}, 200

Note: The address parameter is only used with static wallet projects in dedicated mode. For HD wallet projects, this parameter is ignored.

Static Wallet Mode

When the PayzCore project is configured with a static wallet, the API works the same way but may return additional fields in the response:

Field Type Description
notice str Instructions for the payer (e.g. "Send exact amount")
original_amount str The original requested amount before any adjustments
requires_txid bool Whether the payer must submit their transaction ID

In dedicated address mode, you can specify which static address to assign to a customer using the address parameter on payment creation. In shared address mode, the project's single static address is used automatically.

Before Going Live

Always test your setup before accepting real payments:

  1. Verify your xPub — In the PayzCore dashboard, click "Verify Key" when adding your wallet. Compare address #0 with your wallet app's first receiving address. They must match.
  2. Send a test payment — Create a monitoring request for $1–5 and send the funds to the assigned address. Verify they arrive in your wallet.
  3. Test sweeping — Send the test funds back out to confirm you control the derived addresses with your private keys.

Warning: A wrong xPub key generates addresses you don't control. Funds sent to those addresses are permanently lost. PayzCore is watch-only and cannot recover funds. Please take 2 minutes to verify.

Configuration

client = PayzCore(
    "pk_live_xxx",
    base_url="https://api.payzcore.com",  # API base URL
    timeout=30.0,                          # Request timeout (seconds)
    max_retries=2,                         # Retries on 5xx/network errors (POST only when external_order_id is set)
    master_key=False,                      # Use x-master-key header
)

Error Handling

import time

from payzcore import (
    PayzCore,
    PayzCoreError,
    AuthenticationError,
    ValidationError,
    RateLimitError,
    NotFoundError,
)

client = PayzCore("pk_live_xxx")

try:
    payment = client.payments.create(
        amount=50, network="TRC20", external_ref="user-123"
    )
except AuthenticationError:
    print("Invalid API key")
except ValidationError as e:
    print(f"Invalid params: {e.message}")
except RateLimitError as e:
    # retry_after is a Unix timestamp (seconds), not a duration
    wait = max(0, (e.retry_after or 0) - int(time.time()))
    print(f"Rate limited. Daily: {e.is_daily}, retry in {wait}s")
except NotFoundError:
    print("Resource not found")
except PayzCoreError as e:
    print(f"API error {e.status}: {e.message}")

Error Classes

Class Status When
AuthenticationError 401 Invalid/missing API key
ForbiddenError 403 Project deactivated
NotFoundError 404 Payment/resource not found
ValidationError 400 Invalid request body
RateLimitError 429 Rate limit or daily plan limit exceeded
IdempotencyError 409 external_order_id reused with different external_ref
WebhookSignatureError — Invalid webhook signature

Requirements

  • Python 3.9+
  • httpx

See Also

License

MIT

Metadata

Release files for payzcore 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for payzcore 1.0.3
File Size Uploaded Provenance Actions
payzcore-1.0.3.tar.gz 15.1 kB Without provenance Details for payzcore-1.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for payzcore 1.0.3
File Interpreter ABI Platform Actions
payzcore-1.0.3-py3-none-any.whl Python 3 none any Details for payzcore-1.0.3-py3-none-any.whl

Total release size: 31.9 kB

Release files / payzcore-1.0.3.tar.gz

Download URL payzcore-1.0.3.tar.gz
Size 15.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7a3f28b2c3bfee7805a3c4d3bef42b3e287c2389a890dff9d8f92fb231955877
BLAKE2b-256 checksum
How to use checksums
fce57d5ab3f66df21c30bc0947a8fe5099d12c27810ce0fdd34ed4467a3bb2a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / payzcore-1.0.3-py3-none-any.whl

Download URL payzcore-1.0.3-py3-none-any.whl
Size 16.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f1b5e41c89a8dbb6da66100b21a35d32c366d7c0d1e4199bcc36b1f804b9eda
BLAKE2b-256 checksum
How to use checksums
bf0488153a7b0ce9439bdfc2cb60d40614a7d92d4a73209439c8381a51367f3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for payzcore 1.0.3

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page