定制 vp-trading/moneyman 二次开发

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

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

vp-trading/moneyman

Composer 安装命令:

composer require vp-trading/moneyman

包简介

README 文档

README

Packagist Version Total Downloads PHP Version Require License CI Code Style Larastan

Installation

To install the MoneyMan package, follow these steps:

  1. Require the package via Composer:

    composer require vp-trading/moneyman
  2. Publish the configuration, route, and migration files:

    php artisan vendor:publish --provider="Vptrading\MoneyMan\MoneyManServiceProvider"

    The package comes with a config files to help you get started quickly.

  3. Configure your .env file:

    Add your Providers API keys:

    MONEYMAN_REF_PREFIX=
    
    MONEYMAN_CHAPA_SECRET_KEY=
    MONEYMAN_CHAPA_BASE_URL=
    MONEYMAN_CHAPA_CALLBACK_URL=
    MONEYMAN_CHAPA_WEBHOOK_SECRET=
    
    MONEYMAN_SANTIMPAY_BASE_URL=
    MONEYMAN_SANTIMPAY_PUBLIC_KEY=
    MONEYMAN_SANTIMPAY_PRIVATE_KEY=
    MONEYMAN_SANTIMPAY_MERCHANT_ID=
    MONEYMAN_SANTIMPAY_TOKEN=
    MONEYMAN_SANTIMPAY_CALLBACK_URL=
    
    MONEYMAN_TELEBIRR_MERCHANT_APP_ID=
    MONEYMAN_TELEBIRR_FABRIC_APP_ID=
    MONEYMAN_TELEBIRR_SHORT_CODE=
    MONEYMAN_TELEBIRR_APP_SECRET=
    MONEYMAN_TELEBIRR_PRIVATE_KEY=
    MONEYMAN_TELEBIRR_BASE_URL=
    MONEYMAN_TELEBIRR_TIMEOUT=
    MONEYMAN_TELEBIRR_CALLBACK_URL=
    MONEYMAN_TELEBIRR_WEB_BASE_URL=
    
    MONEYMAN_BOA_USSD_BASE_URL=
    MONEYMAN_BOA_USSD_CLIENT_ID=
    MONEYMAN_BOA_USSD_CLIENT_SECRET=
    MONEYMAN_BOA_USSD_REFRESH_TOKEN=
    MONEYMAN_BOA_USSD_MERCHANT_NAME=
    MONEYMAN_BOA_USSD_MERCHANT_ACCOUNT=
    MONEYMAN_BOA_USSD_API_KEY=
  4. Ready to use!

    You can now use the package in your Laravel application.

Support

Provider Payment Initialize Payment Verify Payment Refund
Chapa
Telebirr
SantimPay
BoaUssd

Usage

Before you start using this package you should know all amount must be put in cent values. The development of this package took standards from Stripe. So for example if you want the amount be 100 Birr you will put 10000.

Here are some basic usage examples:

Initialize Payment

use Vptrading\MoneyMan\MoneyMan;
use Vptrading\MoneyMan\Enums\Provider;
use Vptrading\MoneyMan\ValueObjects\User;
use Money\Money;

$response = MoneyMan::provider(Provider::Chapa)->initiate([
    Money::ETB(10000),
    new User(
        firstName: 'John',
        lastName: 'Doe',
        email: 'johndoe@example.com',
        phoneNumber: '0912345678'
    ),
    route('return-url')
]);

// Redirect user to payment page
return redirect($response->checkoutUrl);

The initiate response is a DTO that consists of the status of of the request, message if the provider has one, transactionId, and checkoutUrl if the request was successful.

For telebirr you will need to wrap the checkoutUrl provided in an <a> tag for it to work or else you will see an error: "Payment cannot be completed. The required parameter of the request is empty, or the parameter is incorrectly filled."

For BoaUssd, there is no checkoutUrl because it is a USSD flow. The provider returns once the user PIN interaction is completed on the phone.

Verify Payment

use Vptrading\MoneyMan\MoneyMan;
use Vptrading\MoneyMan\Enums\Provider;
use Money\Money;

$response = MoneyMan::provider(Provider::Chapa)->verify($transactionId);

The verify response is a DTO that consists of the status of of the request, message if the provider has one, transactionId, and data which is the response from the provider.

For BoaUssd, pass the billNumber (reference) returned during initiate as the transactionId to verify(). The package verifies using GET /ussd/push/getStatus?reference={billNumber}.

BoaUssd tokens are persisted in the boa_tokens table and are encrypted at rest using Laravel encrypted model casts. On expired access token / 401, the package refreshes with refresh token and retries once automatically.

Refund Payment

use Vptrading\MoneyMan\MoneyMan;
use Vptrading\MoneyMan\Enums\Provider;
use Money\Money;

$response = MoneyMan::provider(Provider::Chapa)->refund($transactionId, Money::ETB(1000));

The refund response is a DTO that consists of the status of of the request, message if the provider has one, transactionId, and data which is the response from the provider.

Note: Chapa's refund does not use the transactionId you provided but instead the reference Id they assign to the transaction.

vp-trading/moneyman 适用场景与选型建议

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

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

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