Skip to main content

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 package

Requirements

  • Python 3.8 or higher
  • pip

Installation

Install via pip:
Or install from source:

Quick start

1. Initialize the SDK

Store your API key in environment variables, never hardcoded in source code.

3. Check payment status

Complete e-commerce example

API reference

OCPay class

Main entry point for the SDK.

Constructor

string
required
Your OneClickDz API access token.
ClientOptions
Optional client configuration.
Example:
Creates a new payment link.
CreateLinkRequest
required
Payment link creation request.
Returns:
string
The payment page URL to share with your customer.
string
Unique payment reference code (e.g., OCPL-A1B2C3-D4E5). Save this to track payment status.
Raises: ValidationException (400), UnauthorizedException (403), ApiException

check_payment(payment_ref)

Checks the status of a payment.
string
required
Payment reference code returned by create_link (e.g., "OCPL-A1B2C3-D4E5").
Returns:
PaymentStatus
Current payment status: PENDING, CONFIRMED, or FAILED.
string
Human-readable status message.
TransactionDetails
Confirmed transaction details. Only present when status is CONFIRMED.
Raises: NotFoundException (404), PaymentExpiredException (410), ApiException

Enums

FeeMode

PaymentStatus

Exception classes

Raised when the request data is invalid (e.g., amount out of range, missing required fields).Properties: message, status_code, request_id, error_data
Raised when authentication fails. Check that your API key is valid and active.Properties: message, status_code, request_id, error_data
Raised when the payment reference does not exist.Properties: message, status_code, request_id, error_data
Raised when the payment link has expired. Links expire 20 minutes after creation.Properties: message, status_code, request_id, error_data
Base exception for all other API errors. Catch this as a fallback.Properties: message, status_code, request_id, error_data

Error handling

Framework integration

Important notes

Merchant validation required - Complete merchant validation at app.oneclickdz.com/profile before using the API.
Amount limits - Minimum 500 DZD, maximum 500,000 DZD. Must be whole numbers (no decimals).
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