1. Go to this page and download the library: Download kloutit/kloutit-sdk-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/ */
kloutit / kloutit-sdk-php example snippets
Kloutit\Configuration as KloutitConfiguration;
use Kloutit\Api\KloutitCaseApi;
use Kloutit\Model\ClientsCreateCaseRequestDto;
use Kloutit\Model\CaseSector;
use Kloutit\Model\Currencies;
$apiKey = 'YOUR_API_KEY';
$client = new GuzzleHttp\Client();
// Configure API key authentication
$config = KloutitConfiguration::getDefaultConfiguration()
->setApiKey($apiKey);
// Create KloutitCaseApi instance
$kloutitCase = new KloutitCaseApi($client, $config);
try {
echo "Creating new case\n";
$newCaseBody = new ClientsCreateCaseRequestDto([
'expedientNumber' => 'UNIQUE_CASE_ID',
'sector' => CaseSector::TECHNOLOGY,
'chargebackAmount' => [
'value' => 100,
'currency' => Currencies::EUR,
],
'chargebackDate' => '2025-01-01T10:00:00.000Z',
'reasonCode' => '4855',
// Additional fields based on sector
// Configure API key authentication
$config = KloutitConfiguration::getDefaultConfiguration()
->setApiKey('YOUR_API_KEY');
// Create KloutitCaseApi instance
$kloutitCase = new KloutitCaseApi(new GuzzleHttp\Client(), $config);
$expedientNumber = 'CASE_EXPEDIENT_NUMBER';
// Update case with additional information
$kloutitCaseBody = new UpdateCaseParams([
'sector' => CaseSector::TECHNOLOGY,
'filialIdentifier' => 'B12345678', // If you do not have filials in your organization, leave this field empty
'transactionDate' => (new DateTime())->format(DateTime::ATOM), // UTC date in ISO 8601 format, e.g: '2025-01-01T10:00:00.000Z'
'bankName' => 'Sample Bank Name',
'cardBrand' => 'Sample card brand',
'last4Digits' => '1234',
'is3DSPurchase' => true,
'purchaseDate' => '2025-01-01T10:00:00.000Z',
'purchaseAmount' => [
'currency' => Currencies::EUR,
'value' => 100
],
'isChargeRefundable' => false,
'customerName' => 'PHP SDK sample',
'customerEmail' => '[email protected]',
'customerPhone' => '612345678',
'additionalInfo' => 'Some optional additional info',
'communications' => [
[
'sender' => 'Sender name',
'content' => 'Communication content',
'date' => '2025-01-01T10:00:00.000Z',
]
],
'product' => 'Sample product',
'service' => 'Sample Service Name',
'shippingCity' => 'Barcelona',
'shippingProvince' => 'Barcelona',
'shippingPostalCode' => '08000',
'deliveryConfirmation' => true,
'shippingDate' => '2025-01-01T10:00:00.000Z',
'deliveryDate' => '2025-01-01T10:00:00.000Z',
'deliveryCompany' => 'Sample delivery company',
]);
try {
echo "Updating existing case\n";
$updatedCase = $kloutitCase->updateCase($expedientNumber, $kloutitCaseBody);
echo "Case updated successfully!\n";
} catch (Exception $e) {
echo "Error updating case: " . $e->getMessage() . "\n";
throw $e;
}