PHP code example of datomatic / carta-del-docente

1. Go to this page and download the library: Download datomatic/carta-del-docente 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/ */

    

datomatic / carta-del-docente example snippets


//Test
$testClient = new Datomatic\CartaDelDocente\CartaDelDocenteClient();

//Produzione
$client = new Datomatic\CartaDelDocente\CartaDelDocenteClient('../path/certificate.pem', 'passwordCertificato');

$result = $client->check(1, 'voucher');

$result->name // CF o nominativo del beneficiario
$result->vatId // partita IVA esercente
$result->scope // l'ambito del voucher (cinema, teatro, libreria,...)
$result->good // il tipo di bene (libri, spettacoli,...)
$result->amount // importo totale del buono

$result = $client->confirm(1, 'Codice Voucher', 52.50);

$client->merchantActivation();

Datomatic\CartaDelDocente\CartaDelDocenteResponse {
  +name: "Attivazione effettuata"
  +vatId: "12345678901" // p.IVA esercente attivato
  +scope: "-"
  +good: "-"
  +amount: 0
}