PHP code example of kloutit / kloutit-sdk-php

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



// Require composer autoloader
tConfiguration;
use Kloutit\Api\KloutitCaseApi;
use Kloutit\Model\UpdateCaseParams;
use Kloutit\Model\CaseSector;
use Kloutit\Model\Currencies;

$apiKey = 'YOUR_API_KEY';
$expedientNumber = 'EXPEDIENT_NUMBER';

// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
$client = new GuzzleHttp\Client();

// Configure api key auth
$config = KloutitConfiguration::getDefaultConfiguration()
    ->setApiKey($apiKey);

// Create KloutitCaseApi instance
$kloutitCase = new KloutitCaseApi(
    $client,
    $config,
);

// Update case
$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',
    'cardBrand' => 'Sample card brand',
    'last4Digits' => '1234',
    'is3DSPurchase' => true,
    'purchaseDate' => '2025-01-01T10:00:00.000Z',
    'purchaseAmount' => [
        'currency' => Currencies::EUR,
        'value' => 10
    ],
    'isChargeRefundable' => true,
    'customerName' => 'Node 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',
    'shippingCity' => 'Barcelona',
    'shippingProvince' => 'Barcelona',
    'shippingPostalCode' => '08000',
    'deliveryConfirmation' => true,
    'shippingDate' => '2025-01-01T10:00:00.000Z',
    'deliveryDate' => '2025-01-01T10:00:00.000Z',
    'deliveryCompany' => 'Sample company',
]);

try {
    $kloutitCase->updateCase($expedientNumber,$kloutitCaseBody);
    echo "Case successfully updated into Kloutit!\n";
} catch (Exception $e) {
    echo "Error trying to update case into Kloutit.\n";
    throw new Exception($e->getMessage());
}

composer