Functii API

Adaugarea Bonurilor

Metoda de adaugare a documentelor se apeleaza la adresa: https://appv1.facturis-online.ro/facturis/api/add_bill.php

Se face un POST pe pagina cu urmatorii parametrii:

xml_string – textul xml ce contine datele de logare si datele bonului


<?php
 $xml_string='<?xml version="1.0" encoding="ISO-8859-1"?>
 <addInvoice>
   <login>
        <pass>xxxxxx</pass>
   </login>   
   <invoice>
       <office></office>
       <administration></administration> 
       <issueDate>2017-03-06 08:00:00</issueDate>
       <currency>RON</currency>
       <client></client>
       <clientType></clientType>
       <registerNumber></registerNumber>
       <taxCode></taxCode>
       <address></address>
       <county></county>
       <bankAccount></bankAccount>
       <bank></bank>
       <representative></representative>
       <representativeId></representativeId>
       <deliveryPerson></deliveryPerson>
       <deliveryAddress></deliveryAddress>        
       <observations></observations>
       <VATrate>19%</VATrate>
       <paymentType>Cash</paymentType>
       <Status>Emis</Status>
       <cash></cash>
       <card></card>
       <ticket></ticket>      
       <products>
           <product>
               <productId>12345</productId>
               <productName>produs1</productName>
               <unit>buc</unit>
               <amount>2</amount>
               <unitPrice>6</unitPrice>
               <value>12</value>
               <VAT>2.88</VAT>
               <discount>0</discount>
               <productCodEan></productCodEan>
               <productCodSku></productCodSku>
               <productAltCod></productAltCod>
               <sincStocField></sincStocField>
           </product>
           <product>
               <productId>123456</productId>
               <productName>produs2</productName>
               <unit>buc</unit>
               <amount>1</amount>
               <unitPrice>120</unitPrice>
               <value>120</value>
               <VAT>28.80</VAT>
               <discount>0</discount> 
               <productCodEan></productCodEan>
               <productCodSku></productCodSku>
               <productAltCod></productAltCod>
               <sincStocField></sincStocField>             
           </product>
           <product>
               <productId>1234567</productId>
               <productName>produs3</productName>
               <unit>buc</unit>
               <amount>3</amount>
               <unitPrice>50</unitPrice>
               <value>150</value>
               <VAT>36</VAT>
               <discount>6</discount>
               <productCodEan></productCodEan>
               <productCodSku></productCodSku>
               <productAltCod></productAltCod>
               <sincStocField></sincStocField>             
           </product>
       </products>
   </invoice>
 </addInvoice>';
  
  $curl_options = array(
   CURLOPT_URL => "https://appv1.facturis-online.ro/facturis/api/add_bill.php",
   CURLOPT_POST => true,
   CURLOPT_POSTFIELDS => "xml_string=$xml_string",
   CURLOPT_RETURNTRANSFER => true,
   CURLOPT_HEADER => false,
   CURLOPT_TIMEOUT => 30,
   CURLOPT_CONNECTTIMEOUT => 5
 );
  
 $curl = curl_init();
 curl_setopt_array( $curl, $curl_options );
 $result = curl_exec( $curl );
 
 var_dump($result);



0
Ultimele articole RO-eFactura: