定制 contipay/php-sdk 二次开发

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

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

contipay/php-sdk

最新稳定版本:1.0.3

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 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->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'
]);

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

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

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.

统计信息

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

GitHub 信息

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

其他信息

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