承接 useepay/useepay-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

useepay/useepay-php

Composer 安装命令:

composer require useepay/useepay-php

包简介

Official UseePay PHP SDK for payment processing. Supports PHP 5.4+ with comprehensive payment gateway integration.

README 文档

README

Latest Version PHP Version License

Official UseePay PHP SDK for payment processing. Compatible with PHP 5.4+.

Features

  • 💳 Complete payment processing integration
  • 👥 Customer management
  • 🔐 Secure authentication with API keys
  • 🌐 Support for multiple environments (Production & Sandbox)
  • 📦 Easy integration with Composer
  • ✅ PHP 5.4+ compatibility
  • 🔒 SSL certificate auto-detection
  • ⚡ Configurable timeouts and retries

Requirements

  • PHP >= 5.4.0
  • cURL extension
  • JSON extension
  • mbstring extension

Installation

Install via Composer:

composer require useepay/useepay-php

Quick Start

Initialize Client

<?php
require_once 'vendor/autoload.php';

use UseePay\UseePayClient;
use UseePay\Model\Authentication\Authentication;
use UseePay\Net\ApiEnvironment;

// Initialize authentication
$authentication = new Authentication(
    'YOUR_MERCHANT_NO',
    'YOUR_APP_ID',
    'YOUR_API_KEY'
);

// Create client (Production)
$client = new UseePayClient($authentication);

// Or use Sandbox environment
$client = UseePayClient::withEnvironment(
    ApiEnvironment::SANDBOX,
    $authentication
);

Create Payment Intent

<?php
use UseePay\UseePay;

// Optional: Configure timeouts
UseePay::setConnectTimeout(30);
UseePay::setReadTimeout(60);

// Create payment
$paymentParams = array(
    'amount' => 100.00,
    'currency' => 'USD',
    'description' => 'Order #12345',
    'merchant_order_id' => 'ORDER_12345',
    'customer' => array(
        'merchant_customer_id' => 'CUST_001',
        'first_name' => 'John',
        'last_name' => 'Doe',
        'email' => 'john.doe@example.com',
        'phone' => '+1234567890',
        'address' => array(
            'line1' => '123 Main St',
            'city' => 'New York',
            'state' => 'NY',
            'postal_code' => '10001',
            'country' => 'US'
        )
    )
);

$paymentIntent = $client->paymentIntents()->create($paymentParams);

// Handle redirect for payment
if ($paymentIntent['status'] === 'requires_payment_method') {
    $redirectUrl = $paymentIntent['next_action']['redirect']['url'];
    header('Location: ' . $redirectUrl);
    exit;
}

Create Customer

<?php
use UseePay\Param\Customer\CustomerCreateParams;

$params = new CustomerCreateParams();
$params->merchantCustomerId = 'CUST_' . time();
$params->firstName = 'John';
$params->lastName = 'Doe';
$params->email = 'john.doe@example.com';
$params->phone = '+1234567890';

$customer = $client->customers()->create($params);
echo "Customer ID: " . $customer['id'];

Retrieve Customer

<?php
$customerId = 'cus_xxxxxxxxxxxxx';
$customer = $client->customers()->retrieve($customerId);
print_r($customer);

List Customers

<?php
use UseePay\Param\Customer\CustomerListParams;

$params = new CustomerListParams();
$params->limit = 10;
$params->startingAfter = null;

$customers = $client->customers()->list($params);
foreach ($customers['data'] as $customer) {
    echo $customer['email'] . "\n";
}

Configuration

SSL Certificate Verification

<?php
use UseePay\UseePay;

// Disable SSL verification (NOT recommended for production)
UseePay::setVerifySslCerts(false);

// Set custom CA bundle path
UseePay::setCaBundlePath('/path/to/cacert.pem');

Timeout Configuration

<?php
use UseePay\UseePay;

// Set connection timeout (default: 6 seconds)
UseePay::setConnectTimeout(30);

// Set read timeout (default: 30 seconds)
UseePay::setReadTimeout(60);

// Set max network retries (default: 0)
UseePay::setMaxNetworkRetries(3);

Error Handling

<?php
use UseePay\Exception\ApiException;
use UseePay\Exception\AuthenticationException;

try {
    $paymentIntent = $client->paymentIntents()->create($params);
} catch (AuthenticationException $e) {
    // Handle authentication errors
    echo "Authentication failed: " . $e->getMessage();
} catch (ApiException $e) {
    // Handle API errors
    echo "API error: " . $e->getMessage();
    echo "Error code: " . $e->getCode();
} catch (Exception $e) {
    // Handle other errors
    echo "Error: " . $e->getMessage();
}

Examples

Complete examples are available in the examples/ directory:

  • Customer Management: examples/CustomerExample.php
  • Payment Checkout: examples/checkout.html + examples/checkout_handler.php
  • E-commerce Demo: examples/clothing_shop.html

API Documentation

For detailed API documentation, visit:

Support

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Changelog

See CHANGELOG.md for version history and updates.

Made with ❤️ by the UseePay Team

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

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

它主要适用于以下技术方向: 「api」 「payment」 「checkout」 「sdk」 「payment processing」 「php5」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2025-10-20