contipay/php-sdk

The Contipay PHP Client provides a simple and secure way to integrate Contipay payments into any PHP application

1.0.0 2025-09-18 08:07 UTC

This package is auto-updated.

Last update: 2025-09-18 08:11:56 UTC


README

A simple and secure PHP SDK for integrating payments with the ContiPay platform. Process mobile money and card payments with ease.

Latest Version PHP Version License

Installation

Install the package via Composer:

composer require contipay/php-sdk

Quick Start

use ContiPay\PhpSdk\Mobile;

// Initialize the SDK
$contipay = new Mobile('your_api_key', 'your_api_secret');

// Process a payment
$response = $contipay->ecocash([
    'amount' => '50.00',
    'currency' => 'USD',
    'phone' => '0782000340',
    'reference' => uniqid('PAY-')
]);

Configuration

Basic Setup

The SDK provides two main classes:

  • Mobile - For mobile money payments
  • Card - For card payments
use ContiPay\PhpSdk\Mobile;
use ContiPay\PhpSdk\Card;

// Mobile payments
$mobile = new Mobile($apiKey, $apiSecret, $mode, $method);

// Card payments
$card = new Card($apiKey, $apiSecret, $mode, $method);

Configuration Parameters

Parameter Description Options Default
$apiKey Your ContiPay API key - Required
$apiSecret Your ContiPay API secret - Required
$mode Environment mode dev, live dev
$method Payment flow direct, redirect direct

Mobile Payments

Supported Providers

  • EcoCash
  • OneMoney
  • Omari
  • InnBucks
  • EcoCash ($contipay->ecocash([...]))
  • OneMoney ($contipay->onemoney([...]))
  • Omari ($contipay->omari([...]))
  • InnBucks ($contipay->innbucks([...]))

Example: Process Mobile Payment

use ContiPay\PhpSdk\Mobile;

$contipay = new Mobile('your_api_key', 'your_api_secret');

// Configure merchant details
$contipay->setMerchantId(12345);
$contipay->setWebhookUrl('https://your-domain.com/webhook');

try {
    $response = $contipay->ecocash([
        'amount' => '50.00',
        'currency' => 'USD',
        'phone' => '0782000340',
        'reference' => uniqid('ECO-'),
    ]);
    
    $result = json_decode($response, true);
    // Handle success
} catch (\Throwable $e) {
    // Handle error
}

Card Payments

Supported Cards

  • Visa
  • MasterCard
  • ZimSwitch
  • Visa ($contipay->visa([...]))
  • MasterCard ($contipay->mastercard([...]))
  • ZimSwitch ($contipay->zimswitch([...]))

Example: Process Card Payment

use ContiPay\PhpSdk\Card;

$contipay = new Card('your_api_key', 'your_api_secret', 'live', 'redirect');

// Configure merchant details
$contipay->setMerchantId(12345);
$contipay->setWebhookUrl('https://your-domain.com/webhook');

// Required for redirect flow
$contipay->setSuccessUrl('https://your-domain.com/success');
$contipay->setErrorUrl('https://your-domain.com/error');

try {
    $response = $contipay->visa([
        'firstName' => 'John',
        'lastName' => 'Doe',
        'accountNumber' => '4111111111111111',
        'accountExpiry' => '12/26',
        'cvv' => '123',
        'phone' => '0782000340',
        'email' => 'john@example.com',
        'amount' => '50.00',
        'currency' => 'USD',
        'country' => 'ZW',
        'reference' => uniqid('CARD-'),
        'description' => 'Premium Subscription'
    ]);
    
    $result = json_decode($response, true);
    // Handle success
} catch (\Throwable $e) {
    // Handle error
}

Security

  • All API requests are encrypted using TLS
  • Sensitive data is never logged
  • API credentials are required for all requests

Additional Resources

📄 License

This SDK is open-sourced software licensed under the MIT license.