A simple and secure PHP SDK for integrating payments with the ContiPay platform. Process mobile money and card payments with ease.
Install the package via Composer:
composer require contipay/php-sdkuse ContiPay\PhpSdk\Mobile;
// Initialize the SDK
$contipay = new Mobile('your_api_key', 'your_api_secret');
// Process a payment
$response = $contipay->mobile([
'amount' => '50.00',
'currency' => 'USD',
'phone' => '0782000340',
'reference' => uniqid('PAY-'),
'provider' => 'EcoCash',
'code' => 'EC'
]);
OR
// Initialize the SDK
$contipay = new Card('your_api_key', 'your_api_secret');
// Process a payment
$response = $contipay->card([
'accountNumber' => '4111111111111111',
'accountExpiry' => '12/26',
'cvv' => '123',
'phone' => '0782000340',
'amount' => '50.00',
'currency' => 'USD',
'reference' => uniqid('CARD-'),
'provider' => 'Visa',
'code' => 'VA'
]);The SDK provides two main classes:
Mobile- For mobile money paymentsCard- 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);| 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 |
- ✅ EcoCash
- ✅ OneMoney
- ✅ Omari
- ✅ InnBucks
- EcoCash (
$contipay->ecocash([...])) - OneMoney (
$contipay->onemoney([...])) - Omari (
$contipay->omari([...])) - InnBucks (
$contipay->innbucks([...])) - All In One (
$contipay->mobile([...]))
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
}- ✅ Visa
- ✅ MasterCard
- ✅ ZimSwitch
- Visa (
$contipay->visa([...])) - MasterCard (
$contipay->mastercard([...])) - ZimSwitch (
$contipay->zimswitch([...])) - All In One (
$contipay->card([...]))
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
}- All API requests are encrypted using TLS
- Sensitive data is never logged
- API credentials are required for all requests
This SDK is open-sourced software licensed under the MIT license.