Python SDK

Official Python SDK for OxaPay — accept crypto payments, exchanges, and payouts.

Installation

pip install oxapay-python

Quick start

from oxapay_python import OxaPayManager

oxapay = OxaPayManager(timeout=10)
res = (
    oxapay
    .payment("XXXXXX-XXXXXX-XXXXXX-XXXXXX")
    .generate_invoice({
        "amount": 10.5,
        "currency": "USDT",
    })
)

print(res)

Handling Webhooks (Payments & Payouts)

OxaPay sends HMAC header (sha512 over raw request body).


Available methods

🔹payment

🔹account

🔹payout

🔹exchange

🔹common

🔹webhook

  • verify – Validates HMAC header (sha512 of raw body).

  • get_data – Validates HMAC header and return webhook data. More details


Raw responses

By default, endpoints return the unwrapped data field. To receive the full API response (data, status, message, error, version), enable raw mode:

Exceptions

All SDK exceptions extend oxapay.exceptions.OxaPayException:

  • ValidationRequestException (HTTP 400)

  • InvalidApiKeyException (HTTP 401)

  • NotFoundException (HTTP 404)

  • RateLimitException (HTTP 429)

  • ServerErrorException (HTTP 500)

  • ServiceUnavailableException (HTTP 503)

  • HttpException (network/unknown)

  • MissingApiKeyException (missing api key)

  • MissingTrackIdException (missing track id)

  • MissingAddressException (missing address)

  • WebhookSignatureException (bad/missing HMAC)

  • WebhookNotReceivedException (webhook request was not received)

Security Notes

  • Verify webhook HMAC before use input data.

  • Whitelist OxaPay IPs on your firewall (ask support).

  • Use HTTPS everywhere.

  • Store keys in .env, not code.

  • Rotate keys regularly.


Testing (safe & offline)

This package uses pytest and responses for testing.

Compatibility

  • Python 3.8+

Security

If you discover a security vulnerability, please email [email protected]. Do not disclose publicly until it has been fixed.

Contributing

Pull requests are welcome. For major changes, open an issue first.

License

Apache-2.0 — see LICENSE.

Changelog

See CHANGELOG.md for version history.

To view the OxaPay package on PyPI:

Last updated