gomzyakov / payture
PHP client for Payture InPay API
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 3
Open Issues: 16
Type:package
Requires
- php: ^8.1
- ext-dom: *
- ext-json: *
- ext-libxml: *
- ext-simplexml: *
- guzzlehttp/guzzle: ^7.5
- psr/log: ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.15
- gomzyakov/php-cs-fixer-config: ^1.15
- mockery/mockery: ^1.5
- phpstan/phpstan: ^1.8
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2024-02-27 06:41:51 UTC
README
Simple PHP client for Payture InPay API.
InPay is an easy way to accept payments without saving cards. Customer’s card details are entered at Payture gateway web page and all required data security is provided by Payture, saving Merchant efforts and expenses related to card information protection.
Installation
composer require gomzyakov/payture
Usage
<?php $configuration = new \Gomzyakov\Payture\TerminalConfiguration( 'MerchantKey', 'MerchantPassword', 'https://sandbox.payture.com/' ); $transport = new \Gomzyakov\Payture\GuzzleHttp\GuzzleHttpPaytureTransport( new \GuzzleHttp\Client(), $configuration ); $terminal = new \Gomzyakov\Payture\PaytureInPayTerminal($configuration, $transport); $terminal->charge('ORDER_NUMBER_123', 100500);
Tuning
Client configuration
You can pass 3-rd argument to the GuzzleHttpPaytureTransport with the instance of \Gomzyakov\Payture\GuzzleHttp\GuzzleHttpOptionsBag
.
Instance is preconfigured with guzzle \GuzzleHttp\RequestOptions
both global (first constructor argument) and per-operation
(second constructor argument indexed by operation name)
Logging
You can pass 4-th argument to the GuzzleHttpPaytureTransport with instance of PSR-3 LoggerInterface
in order to log operations with parameters.
Also you can configure generic Guzzle logging middleware.
Testing
vendor/bin/phpunit -c phpunit.xml
You can test this library against your own test terminal providing PAYTURE_TEST_MERCHANT_KEY
and PAYTURE_TEST_MERCHANT_PASSWORD
environment variables while running the tests.
PAYTURE_TEST_MERCHANT_KEY=MerchantKey \ PAYTURE_TEST_MERCHANT_PASSWORD=MerchantPassword \ vendor/bin/phpunit -c phpunit.xml
These test will run order processing sequence against payture sandbox.