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

💳 Full Card Payment Example (Visa)

from contipay import Card, Mobile

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

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))

📱 Full Mobile Payment Example (EcoCash)

from contipay import Card, Mobile

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


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": "0771234567",
        "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": "0771234567",
        "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.4.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.4-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: contipay-1.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 94ae6c79b1366108fbc38ab2f406589275b54bf04ea62067e607a964eb09dd24
MD5 c9d468051e4e05f30a136d56131eb4c1
BLAKE2b-256 1c9330eb2ee35f005adcf7165d29bc6cf173a79896fff2edd18edb50d1e4e651

See more details on using hashes here.

File details

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

File metadata

  • Download URL: contipay-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.7 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f15c94a1d620aad9c02e963261439d3ff09647a859aab33c52ff43f6be804fa7
MD5 220ba00f3f12dee4c11152e785be9668
BLAKE2b-256 4c4bc995417d0ba4b6314f0d6b000c35cff77204310ddb3d330f5d9dc718c5d7

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