定制 contipay/php-sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

contipay/php-sdk

Composer 安装命令:

composer require contipay/php-sdk

包简介

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

README 文档

README

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

Latest Version License Why PHP

Installation

Install the package via Composer:

composer require contipay/php-sdk

Quick Start

<?php

use ContiPay\PhpSdk\Card;
use ContiPay\PhpSdk\Mobile;

require_once __DIR__ . '/vendor/autoload.php';

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

 // update Contipay URL (optional)
$contipay->updateContipayURL('new-dev-url', 'new-live-url');

// Process a payment
$response = $contipay->mobile([
    'amount' => '50.00',
    'currency' => 'ZWG',
    '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'
]);

Configuration

Basic Setup

The SDK provides two main classes:

  • Mobile - For mobile money payments
  • Card - For card payments
<?php

use ContiPay\PhpSdk\Mobile;
use ContiPay\PhpSdk\Card;

require_once __DIR__ . '/vendor/autoload.php';

// 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([...]))
  • All In One ($contipay->mobile([...]))

Example: Process Mobile Payment

<?php

use ContiPay\PhpSdk\Mobile;

require_once __DIR__ . '/vendor/autoload.php';

$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
}

OR

Provider Code & Name Options

code provider
EC EcoCash
OM OneMoney
OC Omari
IB InnBucks
<?php

use ContiPay\PhpSdk\Mobile;

require_once __DIR__ . '/vendor/autoload.php';

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

// 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->mobile([
        'amount' => '50.00',
        'currency' => 'USD',
        'phone' => '0782000340',
        'reference' => uniqid('PAY-'),
        'provider' => 'EcoCash',
        'code' => 'EC'
    ]);

    $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([...]))
  • All In One ($contipay->card([...]))

Example: Process Card Payment

<?php

use ContiPay\PhpSdk\Card;

require_once __DIR__ . '/vendor/autoload.php';

$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
}

OR

Provider Code & Name Options

code provider
ZS ZimSwitch
VA Visa
MA MasterCard
<?php

use ContiPay\PhpSdk\Card;

require_once __DIR__ . '/vendor/autoload.php';

$contipay = new Card('your_api_key', 'your_api_secret', 'dev', '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->card([
        'accountNumber' => '4111111111111111',
        'accountExpiry' => '12/26',
        'cvv' => '123',
        'phone' => '0782000340',
        'amount' => '50.00',
        'currency' => 'USD',
        'reference' => uniqid('CARD-'),
        'provider' => 'Visa',
        'code' => 'VA'
    ]);

    $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.

contipay/php-sdk 适用场景与选型建议

contipay/php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 25 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 09 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 contipay/php-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 contipay/php-sdk 我们能提供哪些服务?
定制开发 / 二次开发

基于 contipay/php-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 25
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 14
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-18