PHP code example of paymentassist / paymentassist-php
1. Go to this page and download the library: Download paymentassist/paymentassist-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
paymentassist / paymentassist-php example snippets
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());
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.