connorhu / khvpos
K&H Payment Gateway client library with Symfony and Payum support.
Requires
- php: >=8.2
- ext-bcmath: *
- ext-openssl: *
- psr/http-client: ^1.0
- symfony/property-access: ^6.4 || ^7.2
- symfony/serializer: ^6.4 || ^7.2
- symfony/validator: ^6.4 || ^7.2
Requires (Dev)
- nyholm/psr7: ^1.8
- payum/core: ^1.7
- payum/payum-bundle: ^2.0
- phpstan/phpstan: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpstan/phpstan-symfony: ^2.0
- phpunit/phpunit: ^11.0
- symfony/dependency-injection: ^6.4 || ^7.0
- symfony/dotenv: ^7.0
- symfony/framework-bundle: ^6.4 || ^7.4
- symfony/http-client: ^6.4 || ^7.2
- symfony/var-dumper: ^6.4 || ^7.2
Suggests
- nyholm/psr7: Required PSR-7 implementation (^1.8)
- payum/core: Payum payment processing integration (^1.7)
- symfony/config: Required for Symfony bundle integration (^6.4 || ^7.4)
- symfony/dependency-injection: Required for Symfony bundle integration (^6.4 || ^7.4)
- symfony/http-client: Required PSR-18 HTTP client implementation (^6.4 || ^7.4)
- symfony/http-kernel: Required for Symfony bundle integration (^6.4 || ^7.4)
- 2.x-dev
- v2.0.0
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v1.0-beta2
- v1.0-beta1
- dev-fix/updated-description
- dev-fix/bump-action-versions
- dev-fix/codecov-token
- dev-fix/link-examples
- dev-feature/examples-readme
- dev-fix/badge-image-path-fix
- dev-feature/payum-integration
- dev-connorhu-patch-1
- dev-feature/coverage-improvement
- dev-feature/endpoint-implementation
- dev-chore/php-version-bump
- dev-feature/bundle-merge
- dev-feature/refactor-phpstan
This package is auto-updated.
Last update: 2026-04-11 19:37:47 UTC
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.