Wallogit.com
2017 © Pedro Peláez
PHP SDK for the Payment Assist Partner API
PHP SDK for the Payment Assist Partner API., (*1)
[!NOTE] paymentassist-php v2 is now the default version. For legacy integrations, please see the v1 branch., (*2)
, (*3)
Install with Composer:, (*4)
composer require paymentassist/paymentassist-php:dev-v2, (*5)
Use composer to publish configuration files:, (*6)
composer --working-dir=vendor/paymentassist/paymentassist-php/ run-script publish-config, (*7)
use PaymentAssist\ApiClient; $config = [ 'debug' => true, 'timeout' => 120, 'log' => [ 'debug' => true, 'log_file_name' => 'apiclient.log', 'log_file_path' => 'PATH-TO-YOUR-LOGS-FOLDER', 'log_request_before_response' => true, 'log_app_name' => 'ApiClient', 'log_format' => null, // if null, a default format from GuzzleHttp\MessageFormatter class will be used ], 'verify_ssl_certificate' => true, 'default' => 'partner_api_v1', 'connections' => [ 'partner_api_v1' => [ 'base_uri' => 'https://api.v1.payment-assist.co.uk', 'manifest_path' => 'default', // use manifest files stored within the package 'api_key' => 'YOUR-KEY', 'secret' => 'YOUR-SECRET', 'additional_query_param' => [], ], ], ]; $client = ApiClient::instance($config)->setConnection(ApiClient::PARTNER_API_V1); $response = $client->GetAccountConfigurationDetails(); if ($response->isOK()) { $plans = collection( $response ->getContent() ->getData() ->getPlans() ->toArray() )->map(function ($plan) { return $plan['name']; })->toList(); } else { echo($response->getStatus() . ' ' . $response->getReason()); echo('There was an error fetching plans from the API: ' . $response->getContents()->getMessage()); }
In the above example $config variable contains a config structure which needs to be provided as an argument to ApiClient::instance() static method., (*8)
This structure can be stored in the config section of your application. After installing the package you can publish an example config file. Composer script will copy the file apiclient.php to the config folder in the root folder of your app if it exists, otherwise it will copy the file to the root folder of your app., (*9)
Config file contains the structure and the default config values which can be overridden by the values stored in the file .apiclient.env which will be copied to the root folder of your app., (*10)
Refer to [API documentation][2] for details of valid endpoints and required params., (*11)
We welcome contributions. There are several ways to help out:, (*12)
For integrations support, please email itsupport@payment-assist.co.uk., (*13)