camoo/laravel-mobile-money-payment 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

camoo/laravel-mobile-money-payment

Composer 安装命令:

composer require camoo/laravel-mobile-money-payment

包简介

Official Laravel integration for the Camoo Payment API, providing service providers, facades, webhook handling, and a Cashier-like developer experience.

README 文档

README

A first-class Laravel integration for the Camoo Payment API, built on top of the official PHP SDK. This package provides a clean, expressive, and testable API for handling cashouts, payment verification, account balance, and webhook validation in Laravel applications.

Features

  • ✅ Laravel-native Service Provider
  • ✅ Clean dependency injection (no static SDK usage)
  • ✅ Cashier-like manager (CamooPayManager)
  • ✅ Secure webhook signature verification (HMAC SHA256)
  • ✅ PSR-4 compliant & framework-agnostic SDK underneath
  • ✅ Fully documented via OpenAPI + Postman

Documentation & Resources

  • 📘 OpenAPI Documentation read

  • 📦 Postman Collection download

  • 🧩 Core PHP SDK repo

Requirements

  • PHP 8.1+
  • Laravel 10+
  • Composer

Installation

Install the package via Composer:

composer require camoo/laravel-mobile-money-payment

Publish the configuration file:

php artisan vendor:publish --tag=camoo-payment-config

Configuration

Update your .env file:

CAMOO_PAYMENT_API_KEY=your_api_key
CAMOO_PAYMENT_API_SECRET=your_api_secret
CAMOO_PAYMENT_API_VERSION=v1
CAMOO_PAYMENT_DEBUG=false

CAMOO_WEBHOOK_SECRET=your_webhook_secret

Config file: config/camoo-payment.php

return [
    'api_key'     => env('CAMOO_PAYMENT_API_KEY'),
    'api_secret'  => env('CAMOO_PAYMENT_API_SECRET'),
    'api_version' => env('CAMOO_PAYMENT_API_VERSION', 'v1'),
    'debug'       => env('CAMOO_PAYMENT_DEBUG', false),

    'webhooks' => [
        'secret'            => env('CAMOO_WEBHOOK_SECRET'),
        'signature_header'  => 'X-Camoo-Signature',
        'timestamp_header'  => 'X-Camoo-Timestamp',
        'tolerance_seconds' => 300,
    ],
];

Getting Started

This package exposes a Cashier-like manager you can inject anywhere in your application.

Dependency Injection (Recommended)

use Camoo\LaravelPayment\Services\CamooPayManager;

class PaymentController
{
    public function __construct(
        private CamooPayManager $camooPay
    ) {}

    public function cashout()
    {
        return $this->camooPay->cashout([
            'phone_number' => '+237612345678',
            'amount'       => 5000,
            'notification_url' => route('webhooks.camoo'),
        ]);
    }
}

Cashout Example

$response = $camooPay->cashout([
    'phone_number'      => '+237612345678',
    'amount'            => 5000,
    'currency'          => 'XAF',
    'external_reference'=> 'ORDER-12345',
]);

echo $response->id;
echo $response->status;

Verify a Payment

$payment = $camooPay->verify('934ca3f6-dad6-4503-ae36-c01ca3354183');

echo $payment->status;

Get Account Balance

$account = $camooPay->account();

echo $account->balance->amount;
echo $account->balance->currency->value;

Webhooks

Webhook routes are automatically loaded.

Example Endpoint

POST /webhooks/camoo

Signature Verification

Webhook payloads are automatically verified using:

  • HMAC SHA256
  • Timestamp tolerance
  • Configurable headers

You can inject the verifier manually if needed:

use Camoo\LaravelPayment\Contracts\WebhookSignatureVerifier;

public function handle(Request $request, WebhookSignatureVerifier $verifier)
{
    $verifier->verify($request);
}

Error Handling

All API errors throw a unified exception:

use Camoo\Payment\Exception\ApiException;

try {
    $camooPay->cashout([...]);
} catch (ApiException $e) {
    logger()->error($e->getMessage(), [
        'code' => $e->getCode(),
    ]);
}

Testing

You can easily mock the manager in tests:

$this->mock(CamooPayManager::class)
    ->shouldReceive('cashout')
    ->once()
    ->andReturn($fakePayment);

Architecture Overview

Laravel App
 └── CamooPayManager
      ├── PaymentApi
      ├── AccountApi
      └── PaymentClient (SDK)
           └── HTTP Transport

This ensures:

  • Clean separation of concerns
  • Easy framework portability
  • Long-term maintainability

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Follow PSR-12
  4. Add tests where applicable
  5. Submit a pull request

License

This package is open-source software licensed under the MIT License.

Final Notes

This package is designed to feel native to Laravel, while remaining strictly aligned with the OpenAPI contract.

If you need:

  • Facade support
  • Idempotency helpers
  • Retry middleware
  • Queue-based cashouts
  • Multi-account support Feel free to open an issue or submit a PR!

camoo/laravel-mobile-money-payment 适用场景与选型建议

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

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

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

围绕 camoo/laravel-mobile-money-payment 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-18