定制 kaninstein/multi-acquirer-checkout 二次开发

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

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

kaninstein/multi-acquirer-checkout

Composer 安装命令:

composer require kaninstein/multi-acquirer-checkout

包简介

Multi-acquirer checkout package with DDD architecture for Laravel

README 文档

README

CI Latest Version on Packagist Total Downloads PHP Version License

Headless Laravel package for multi-acquirer payments with a fallback gateway pipeline and fee calculation.

  • Multiple gateways with priority + optional preferred gateway
  • Card / PIX / boleto (per-gateway support)
  • Deterministic fee breakdown (platform fee + gateway fee + financing cost)
  • Optional published HTTP routes (API-first)
  • Optional package migrations (or pure-config/in-memory mode)

Requirements

  • PHP ^8.2
  • Laravel ^10|^11|^12

Installation (Packagist)

composer require kaninstein/multi-acquirer-checkout:^1.0

Configuration

Publish the config file:

php artisan vendor:publish --tag=multi-acquirer-config

Enable routes (optional):

MULTI_ACQUIRER_ROUTES_ENABLED=true
MULTI_ACQUIRER_ROUTES_PREFIX=api/multi-acquirer

Enable package migrations (optional):

MULTI_ACQUIRER_DATABASE_USE_PACKAGE_MIGRATIONS=true

Then publish and run:

php artisan vendor:publish --tag=multi-acquirer-migrations
php artisan migrate

API routes (optional)

When MULTI_ACQUIRER_ROUTES_ENABLED=true, these routes are available under MULTI_ACQUIRER_ROUTES_PREFIX (default: api/multi-acquirer):

  • POST /api/multi-acquirer/checkout
  • POST /api/multi-acquirer/fees
  • GET /api/multi-acquirer/boleto/barcode

POST /checkout

Creates a payment attempt using the gateway pipeline and returns:

  • payment snapshot (status + metadata)
  • fee breakdown
  • gateway response payload (normalized)

Request body:

{
  "amount_cents": 10000,
  "currency": "BRL",
  "payment_method": "pix",
  "installments": 1,
  "customer": { "name": "John Doe", "email": "john@example.com", "document": "123.456.789-00" },
  "gateway": "pagarme",
  "platform_fee_rate": 0.06,
  "merchant_absorbs_financing": false,
  "fee_responsibility": "buyer",
  "metadata": { "order_id": 123, "description": "Product X", "item_code": "product_123" }
}

Notes:

  • platform_fee_rate is optional. If omitted, the package uses multi-acquirer.fees.platform.default_rate.
  • merchant_absorbs_financing controls who pays installment financing.
  • fee_responsibility controls gross-up behavior (buyer vs merchant).

POST /fees

Computes the fee breakdown without creating a gateway payment (useful for checkout previews).

Request body:

{
  "amount_cents": 10000,
  "payment_method": "card",
  "installments": 3,
  "gateway": "pagarme",
  "platform_fee_rate": 0.06,
  "merchant_absorbs_financing": false,
  "fee_responsibility": "buyer"
}

Response contains fees with fields like:

  • platform_fee_amount_cents
  • gateway_fee_cents
  • financing_cost_cents
  • amount_paid_by_customer_cents
  • merchant_net_amount_cents

Using the package services (no routes)

If you prefer, call the services directly:

  • Kaninstein\MultiAcquirerCheckout\Application\Services\CheckoutService
  • Kaninstein\MultiAcquirerCheckout\Domain\Fee\Services\FeeCalculator

The main input DTO is:

  • Kaninstein\MultiAcquirerCheckout\Application\DTOs\PaymentRequest

Multi-tenant / SaaS setup

This package reads gateway and fee settings from config('multi-acquirer'). In a SaaS, you typically store a JSON blob per tenant/producer in your own database and hydrate Laravel config at runtime (middleware/service provider) before calling the package.

Recommended approach:

  • Store tenant payload under one key (e.g. multi_acquirer) in your app settings table.
  • On each request, set config(['multi-acquirer' => $payload]) (or merge the relevant portions).
  • Keep the payment domain inside this package; keep only project-specific mapping in your app.

Development

composer test
composer phpstan
composer format

kaninstein/multi-acquirer-checkout 适用场景与选型建议

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

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

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

围绕 kaninstein/multi-acquirer-checkout 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-15