PHP code example of silverback / fattureincloud

1. Go to this page and download the library: Download silverback/fattureincloud 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/ */

    

silverback / fattureincloud example snippets


use Svbk\FattureInCloud;
use Svbk\FattureInCloud\Struct\DocNuovoArticolo as Product;
use Svbk\FattureInCloud\Struct\DocNuovoRequest as Invoice;
use Svbk\FattureInCloud\Struct\DocNuovoPagamento as Payment;

$client = new FattureInCloud\Client( 'API_UID', 'API_KEY' );

$invoiceProduct = new Product(
  array(
    'nome' => 'Product Name',
    'prezzo_lordo' => 10,
    'cod_iva' => 0,
  )
);

$payment_date = FattureInCloud\Date::createFromFormat( 'Y-m-d H:i:s', date('Y-m-d H:i:s') ); //now
$expire_date = $payment_date;

$invoicePayment = new Payment(
  array(
    'data_scadenza' => $expire_date,
    'importo' => 'auto', //calculate invoice total automatically
    'metodo' => '{{wallet_id}}', //place here your wallet identifier
    'data_saldo' => $payment_date,
  )
);

$newInvoice = new Invoice( 
  array(
    // New Customer will be created by passing details directly.
    'nome' => 'Customer Name',
    'indirizzo_via' => 'Customer Address',
    'indirizzo_cap' => '50000',  //Postal Code
    'indirizzo_citta' => 'Customer City',
    'indirizzo_provincia' => 'Customer State/Province',
    'piva' => 'VATID000000', //vat ID
    'cf' => 'FISCALCODEXXXXX',
    'paese' => 'Customer Country', //must be obtained via $client->getInfoList( array( 'lista_paesi' ) );
    'lista_articoli' => array( $invoiceProduct ),
    'lista_pagamenti' => array( $invoicePayment ),
    'prezzi_ivati' => true, // VAT