connorhu/khvpos
Composer 安装命令:
composer require connorhu/khvpos
包简介
K&H Payment Gateway client library with Symfony and Payum support.
README 文档
README
API documentation HU | API documentation EN
Support chart
| Method | Support |
|---|---|
| echo | yes |
| payment/init | yes |
| payment/process | yes |
| payment/status | yes |
| payment/reverse | yes |
| payment/close | yes |
| payment/refund | yes |
| oneclick/echo | yes |
| oneclick/init | yes |
| oneclick/process | yes |
| applepay/echo | yes |
| applepay/init | yes |
| applepay/process | yes |
| googlepay/echo | yes |
| googlepay/init | yes |
| googlepay/process | yes |
Installation
composer require connorhu/khvpos
Symfony Bundle
There is no Flex recipe — bundle registration is manual.
Register the bundle
// config/bundles.php return [ KHTools\VPos\Bundle\KHVPosBundle::class => ['all' => true], ];
Configuration
# config/packages/khvpos.yaml khvpos: test: true # set to false for production merchants: default: merchant_id: '%env(KHVPOS_MERCHANT_ID)%' private_key_path: '%kernel.project_dir%/config/keys/merchant.pem' private_key_passphrase: '%env(KHVPOS_PRIVATE_KEY_PASSPHRASE)%' # optional, default '' currency: HUF
A single VPosClient service is registered as khvpos.vpos_client (also autowirable as VPosClient). Inject MerchantProviderInterface to look up the correct merchant by currency:
use KHTools\VPos\Bundle\Providers\MerchantProviderInterface; use KHTools\VPos\Requests\PaymentInitRequest; use KHTools\VPos\VPosClient; public function __construct( private VPosClient $client, private MerchantProviderInterface $merchantProvider, ) {} public function pay(): void { $merchant = $this->merchantProvider->getMerchant('HUF'); $request = new PaymentInitRequest(); $request->setMerchant($merchant); // ... }
Multiple merchants (multiple currencies)
khvpos: test: false merchants: huf: merchant_id: '%env(KHVPOS_HUF_MERCHANT_ID)%' private_key_path: '%kernel.project_dir%/config/keys/huf.pem' currency: HUF eur: merchant_id: '%env(KHVPOS_EUR_MERCHANT_ID)%' private_key_path: '%kernel.project_dir%/config/keys/eur.pem' currency: EUR
$merchantProvider->getMerchant('EUR') returns the EUR merchant.
All configuration options
| Key | Type | Default | Description |
|---|---|---|---|
test |
bool | true |
Use sandbox endpoint |
mips_public_key_path |
string | null |
Path to MIPS public key PEM; null uses the bundled key |
version |
string | rv1 |
API version |
merchants.<name>.merchant_id |
string | required | K&H merchant ID |
merchants.<name>.private_key_path |
string | required | Path to RSA private key PEM |
merchants.<name>.private_key_passphrase |
string | '' |
Optional key passphrase |
merchants.<name>.currency |
string | HUF |
Default currency (HUF, EUR, USD) |
Payum Integration
Requires payum/core ^1.7. For Symfony, also install payum/payum-bundle:
composer require payum/payum-bundle
With payum/payum-bundle installed and a khvpos: config block present, the khvpos Payum gateway is registered automatically — no extra YAML required:
$gateway = $payum->getGateway('khvpos'); $gateway->execute(new Capture($payment));
The first configured merchant is used. Supported Payum requests: Capture, Authorize, Refund, Cancel, Sync, GetHumanStatus, Convert.
connorhu/khvpos 适用场景与选型建议
connorhu/khvpos 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 459 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 04 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 connorhu/khvpos 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 connorhu/khvpos 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 459
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-04-09