be-lenka / everifin-php-sdk
Everifin php sdk
v1.0.1
2023-07-10 12:42 UTC
Requires
- php: ^7.3 || ^8.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2
- guzzlehttp/psr7: ^1.4
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.12
- phpunit/phpunit: ^8.0 || ^9.0
This package is auto-updated.
Last update: 2024-04-10 14:16:33 UTC
README
Installation & Usage
Requirements
PHP 7.3 and later. Should also work with PHP 8.0 but has not been tested.
Composer
To install the bindings via Composer, add the following to composer.json
:
composer require be-lenka/everifin-php-sdk
or
{ "repositories": [ { "type": "vcs", "url": "https://github.com/be-lenka/everifin-php-sdk.git" } ], "require": { "be-lenka/everifin-php-sdk": "*@dev" } }
Then run composer install
Manual Installation
Download the files and include autoload.php
:
<?php require_once('/path/to/vendor/autoload.php');
Getting Started
Please follow the installation procedure and then run the following:
Get access token
<?php require_once(__DIR__ . '/vendor/autoload.php'); $configuration = new \belenka\Everifin\Client\Configuration(); $configuration->setHost('https://app.stage.everifin.com'); $client = new \GuzzleHttp\Client(); $apiInstance = new \belenka\Everifin\Client\Api\GeneralApi($client, $configuration); $client_id = 'client_id_example'; $client_secret = 'client_secret_example'; $grant_type = 'client_credentials'; try { $response = $apiInstance->getClientAccessToken($client_id, $client_secret, $grant_type); print_r($response); print_r($response->getAccessToken()); } catch (Exception $e) { echo 'Exception when calling GeneralApi->getClientAccessToken: ', $e->getMessage(), PHP_EOL; }
Generate Payment Link
<?php require_once(__DIR__ . '/vendor/autoload.php'); $token = $response->getAccessToken(); // Response from getClientAccessToken $configuration = new \belenka\Everifin\Client\Configuration(); $configuration->setHost('https://pay.stage.everifin.com'); $configuration->setAccessToken($token); $client = new \GuzzleHttp\Client(); $apiInstance = new \belenka\Everifin\Client\Api\RedirectFlowApi($client, $configuration); $paymentLinkData = new \belenka\Everifin\Client\Model\PaymentLinkData(); $paymentLinkData->setAmount(123); $paymentLinkData->setConstantSymbol('123'); $paymentLinkData->setCurrency('EUR'); $paymentLinkData->setPaymentMessage('test'); $paymentLinkData->setRecipientIban('SK8709000000001231231234'); $paymentLinkData->setRecipientName('Belenka'); $paymentLinkData->setRedirectUrl('https://www.belenka.sk/kosik'); $paymentLinkData->setSpecificSymbol('123456'); $paymentLinkData->setUserLocale('sk'); $paymentLinkData->setVariableSymbol('123456789'); try { $result = $apiInstance->generatePaymentLink($paymentLinkData); print_r($result); } catch (Exception $e) { echo 'Exception when calling RedirectFlowApi->generatePaymentLink: ', $e->getMessage(), PHP_EOL; }
Init embed payment
<?php require_once(__DIR__ . '/vendor/autoload.php'); $token = $response->getAccessToken(); // Response from getClientAccessToken $configuration = new \belenka\Everifin\Client\Configuration(); $configuration->setHost('https://pay.stage.everifin.com'); $configuration->setAccessToken($token); $client = new \GuzzleHttp\Client(); $apiInstance = new \belenka\Everifin\Client\Api\EmbeddedFlowApi($client, $configuration); $x_ef_sender_ip = '10.1.1.1'; // string $x_ef_sender_user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.0) AppleWebKit/536.1.2 (KHTML, like Gecko) Chrome/39.0.812.0 Safari/536.1.2'; // string $PaymentEmbedData = new \belenka\Everifin\Client\Model\PaymentEmbedData(); try { $result = $apiInstance->initPayment($x_ef_sender_ip, $x_ef_sender_user_agent, $PaymentEmbedData); print_r($result); } catch (Exception $e) { echo 'Exception when calling EmbeddedFlowApi->initPayment: ', $e->getMessage(), PHP_EOL; }
API Endpoints
URIs are relative to https://app.stage.everifin.com or https://pay.stage.everifin.com
Class | Method | HTTP request | Description |
---|---|---|---|
EmbeddedFlowApi | initPayment | POST /api/v1/payments | Init Payment |
EmbeddedFlowApi | processPayment | PATCH /api/v1/payments/{id} | Process Payment |
GeneralApi | getClientAccessToken | POST /auth/realms/everifin_paygate/protocol/openid-connect/token | Get Client Access Token |
GeneralApi | getClientBanks | GET /api/v1/banks | Get Client Banks |
GeneralApi | getPaymentDetail | GET /api/v1/payments/{id} | Get payment detail |
GeneralApi | getPayments | GET /api/v1/payments | Get payments |
GeneralApi | withdrawPayment | DELETE /api/v1/payments/{id} | Withdraw payment |
RedirectFlowApi | generatePaymentLink | POST /api/v1/link | Generate Payment Link |
Models
- PaymentEmbedData
- PaymentFlowData
- PaymentLinkData
- InlineResponse200
- InlineResponse2001
- InlineResponse2001Data
- InlineResponse2001Meta
- InlineResponse2002
- InlineResponse2002Data
- InlineResponse2002Meta
- InlineResponse2002MetaPagination
- InlineResponse2003
- InlineResponse2003Data
- InlineResponse2003DataInputSet
- InlineResponse2003DataInputSet0
- InlineResponse2003DataInputSet1
- InlineResponse2004
- InlineResponse2004Data
- InlineResponse2005
- InlineResponse2005Data
- InlineResponse2006
- InlineResponse2006Data
- InlineResponse2007
- InlineResponse2007Data
- InlineResponse400
- InlineResponse4001
- InlineResponse4001Errors
- InlineResponse4002
- InlineResponse4002Errors
- InlineResponse4003
- InlineResponse4003Errors
- InlineResponse401
- InlineResponse401Errors
- InlineResponse401Meta
- InlineResponse422
- InlineResponse4221
- InlineResponse4221Errors
- InlineResponse422Errors
Authorization
All endpoints do not require authorization.
Tests
To run the tests, use:
composer install vendor/bin/phpunit