Overview
The Navio Python SDK provides a clean, idiomatic interface for integrating Navio payments into your Python applications. Built with Python 3.8+ type hints and dataclasses for the best developer experience.Pythonic API
Clean interface with full type hints and dataclasses
Type safe
Full type annotations with dataclasses and enums
Input validation
Client-side validation for fast error feedback
Minimal dependencies
Only requires the
requests packageRequirements
- Python 3.8 or higher
- pip
Installation
Install via pip:Quick start
1. Initialize the SDK
2. Create a payment link
3. Check payment status
Complete e-commerce example
Full e-commerce order flow
Full e-commerce order flow
API reference
OCPay class
Main entry point for the SDK.Constructor
create_link(request)
Creates a new payment link.
Returns:
Raises: ValidationException (400), UnauthorizedException (403), ApiException
check_payment(payment_ref)
Checks the status of a payment.
Returns:
Raises: NotFoundException (404), PaymentExpiredException (410), ApiException
Enums
FeeMode
PaymentStatus
Exception classes
ValidationException - HTTP 400
ValidationException - HTTP 400
Raised when the request data is invalid (e.g., amount out of range, missing required fields).Properties:
message, status_code, request_id, error_dataNotFoundException - HTTP 404
NotFoundException - HTTP 404
Raised when the payment reference does not exist.Properties:
message, status_code, request_id, error_dataPaymentExpiredException - HTTP 410
PaymentExpiredException - HTTP 410
Raised when the payment link has expired. Links expire 20 minutes after creation.Properties:
message, status_code, request_id, error_dataApiException - various
ApiException - various
Base exception for all other API errors. Catch this as a fallback.Properties:
message, status_code, request_id, error_dataError handling
Framework integration
- Flask
- Django
- FastAPI
Important notes
Link expiration - Payment links expire 20 minutes after creation. After expiration the status becomes
FAILED.Sandbox testing - Use your sandbox API key for testing. Check
response.payment_link.is_sandbox to confirm test mode.API reference
View the Navio API endpoints
Support
Contact our support team
GitHub
View the source on GitHub

