Skip to main content

Official ContiPay Python SDK

Project description

ContiPay Python SDK

Official ContiPay Python SDK for processing Mobile Money and Card Payments.

This SDK provides a clean, secure, and flexible way to integrate ContiPay payment services into your Python applications.


✨ Features

  • 📱 Mobile payments: EcoCash, OneMoney, Omari, InnBucks
  • 💳 Card payments: Visa, MasterCard, ZimSwitch
  • 🌍 Supports Dev and Live environments
  • 🔁 Direct and Redirect payment flows
  • 🔐 Secure API key authentication
  • 🐍 Pythonic, chainable API design

📦 Installation

Install from PyPI:

pip install contipay

🚀 Quick Start

Import & Credentials

from contipay import Card, Mobile

API_KEY = "your_api_key"
API_SECRET = "your_api_secret"
MERCHANT_ID = 123

💳 Card Payment Example (Visa)

print("\n===== CARD TEST =====")

card = (
    Card(API_KEY, API_SECRET, mode="dev")
    .set_urls(
        callback="https://webhook.site/your-test-id",
        success="https://example.com/success",
        error="https://example.com/error"
    )
)

card_payload = {
    "customer": {
        "nationalId": "00000000",
        "surname": "Doe",
        "firstName": "John",
        "middleName": "",
        "email": "john.doe@example.com",
        "cell": "0770000000",
        "countryCode": "ZW"
    },
    "transaction": {
        "providerCode": "VA",
        "providerName": "VISA",
        "currencyCode": "USD",
        "merchantId": MERCHANT_ID,
        "reference": "PYT_121",
        "description": "Payment for Order #1631",
        "amount": 100.00,
        "webhookUrl": "https://yoursite.com/webhook",
        "successUrl": "https://yoursite.com/success",
        "cancelUrl": "https://yoursite.com/cancel"
    },
    "accountDetails": {
        "accountNumber": "5123450000000008",
        "accountName": "John Doe",
        "accountExtra": {
            "code": "123",
            "expiry": "12/2030"
        }
    }
}

print(card.pay("visa", card_payload))

📱 Mobile Payment Example (EcoCash)

print("\n===== MOBILE TEST =====")

mobile = (
    Mobile(API_KEY, API_SECRET, mode="dev")
    .set_callback("https://webhook.site/your-test-id")
)

mobile_payload = {
    "customer": {
        "nationalId": "00000000",
        "surname": "Doe",
        "firstName": "John",
        "middleName": "",
        "email": "john.doe@example.com",
        "cell": "0776368211",
        "countryCode": "ZW"
    },
    "transaction": {
        "providerCode": "EC",
        "providerName": "EcoCash",
        "currencyCode": "USD",
        "merchantId": MERCHANT_ID,
        "reference": "PYT_11",
        "description": "Payment for Order #1631",
        "amount": 100.00,
        "webhookUrl": "https://yoursite.com/webhook",
        "successUrl": "https://yoursite.com/success",
        "cancelUrl": "https://yoursite.com/cancel"
    },
    "accountDetails": {
        "accountNumber": "0776368211",
        "accountName": "John Doe"
    }
}

print(mobile.pay("ecocash", mobile_payload))

⚙️ Configuration

Core Classes

The SDK exposes two main classes:

-> Mobile – Mobile money payments

-> Card – Card payments

Basic Setup

from contipay import Card, Mobile

card = (
    Card(API_KEY, API_SECRET, mode="dev")
    .set_urls(
        callback="https://webhook.site/your-test-id",
        success="https://example.com/success",
        error="https://example.com/error"
    )
)

mobile = (
    Mobile(API_KEY, API_SECRET, mode="dev")
    .set_callback("https://webhook.site/your-test-id")
)

📲 Mobile Payments

Supported Providers

✅ EcoCash

✅ OneMoney

✅ Omari

✅ InnBucks

Provider selection is done using the provider name or code when calling pay().

🔐 Security

All API requests are encrypted using TLS

Sensitive customer data is never logged

API credentials are required for every request

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

contipay-1.0.3.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

contipay-1.0.3-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file contipay-1.0.3.tar.gz.

File metadata

  • Download URL: contipay-1.0.3.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for contipay-1.0.3.tar.gz
Algorithm Hash digest
SHA256 4f46c80e143f2ebab750393a82068d9d23ddb8c3fed2885d74ada68a90dedaeb
MD5 94f3ac41f29ee8b4ebb4fbc36f2152c7
BLAKE2b-256 d38a6db885e06869db528dd6a91152e6f0eeda79190831da89bee33cc163f867

See more details on using hashes here.

File details

Details for the file contipay-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: contipay-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for contipay-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cfa1c072f2d33fec5f6744e88390834be9fc918fd9e5cacb2e2a53db3938300e
MD5 62323b6e102c5f6ae08eb9e5fe472a97
BLAKE2b-256 2dc06e912c6e096aebd026c8f5fbafb9c042275f34240cb1e60ab558f92f365b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page