Python SDK
Official Python SDK for OxaPay — accept crypto payments, exchanges, and payouts.
Installation
pip install oxapay-pythonQuick 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
HMACheader (sha512 over raw request body).
Available methods
🔹payment
generate_invoice– Create invoice & get payment URL. More detailsgenerate_white_label– White-label payment. More detailsgenerate_static_address– Create static deposit address. More detailsrevoke_static_address– Revoke static address. More detailsstatic_address_list– List static addresses. More detailsinformation– Single payment information. More detailshistory– Payment history list. More detailsaccepted_currencies– Accepted currencies. More details
🔹account
balance– Account balance. More details
🔹payout
generate– Request payout. More detailsinformation– Single payout information. More detailshistory– Payout history list. More details
🔹exchange
swap_request– Swap request. More detailsswap_history– Swap history. More detailsswap_pairs– Swap pairs. More detailsswap_calculate– Swap pre-calc. More detailsswap_rate– Swap Quote rate. More details
🔹common
prices– Market prices. More detailscurrencies– Supported crypto. More detailsfiats– Supported fiats. More detailsnetworks– Supported networks. More detailsmonitor– System status. More details
🔹webhook
verify– ValidatesHMACheader (sha512 of raw body).get_data– ValidatesHMACheader 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