PHP code example of iucto / iucto-api-php-sdk
1. Go to this page and download the library: Download iucto/iucto-api-php-sdk 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/ */
iucto / iucto-api-php-sdk example snippets
$iUcto = IUcto\IUctoFactory::create('your-secret-key');
try {
$invoiceList = $iUcto->getInvoiceIssued();
foreach ($invoiceList as $invoice) {
var_dump($invoice->getId());
}
} catch (IUcto\ConnectionException $e) {
// handle connection exception
} catch (\IUcto\ValidationException $e) {
//handle validation exception
}
$iUcto = IUcto\IUctoFactory::create('your-secret-key');
try {
$customer = new \IUcto\Command\SaveCustomer();
$customer->setName('Jan Novák');
$customer->setComid('123456');
$customer->setVatid('CZ123456');
$customer->setVatPayer(true);
$customer->setPhone('+420123123123');
$customer->setUsualMaturity(14);
$customer->setPreferredPaymentMethod('transfer');
$customer->setInvoiceLanguage('cs');
$address = new \IUcto\Dto\Address();
$address->setCountry('CZ');
$address->setStreet('Lanova 52/12');
$address->setCity('Praha');
$address->setPostalcode('21005');
// Přiřazení adresy k zákazníkovi
$customer->setAddress($address);
$iUcto->createCustomer($customer);
} catch (IUcto\ConnectionException $e) {
// handle connection exception
} catch (\IUcto\ValidationException $e) {
//handle validation exception
}