galchenok / payture

PHP client for Payture InPay API

Home Page:https://packagist.org/packages/gomzyakov/payture

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Payture InPay Client

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.

codecov

Installation

composer require gomzyakov/payture

Usage

<?php

# Minimal initialization
$configuration = new \Gomzyakov\Payture\InPayClient\TerminalConfiguration(
    'MerchantKey',
    'MerchantPassword',
    'https://sandbox.payture.com/'
);

$transport = new \Gomzyakov\Payture\InPayClient\GuzzleHttp\GuzzleHttpPaytureTransport(
    new \GuzzleHttp\Client(),
    $configuration
);

$terminal = new \Gomzyakov\Payture\InPayClient\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\InPayClient\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.

About

PHP client for Payture InPay API

https://packagist.org/packages/gomzyakov/payture

License:MIT License


Languages

Language:PHP 98.1%Language:Makefile 1.3%Language:Dockerfile 0.6%