Skip to content

Instantly share code, notes, and snippets.

View aphilippi's full-sized avatar

Andreas Philippi aphilippi

  • Cubus Arts SRL
  • Brasov
View GitHub Profile
@aphilippi
aphilippi / factureaza_update_client_data_on_invoice.php
Last active May 6, 2019 09:37
Update client record and update invoice for client to reflect changes
<?php
//set BASE_URL to https://factureaza.ro/api/v1/ for production
define('BASE_URL', 'https://sandbox.factureaza.ro/api/v1/');
//replace with the api key provided in the backend
define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$client_id = 1064116434; // your client id here
$changes = array("client" => array("name" => 'Nume client schimbat', "city" => "Nume oras nou"));
$url = BASE_URL . 'clients/' . $client_id . '.xml' ;
$ch = curl_init();
@aphilippi
aphilippi / factureaza_update_invoice.php
Last active July 29, 2020 12:19
Modificarea datelor unei facturi deja create
<?php
//set BASE_URL to https://factureaza.ro/api/v1/ for production
define('BASE_URL', 'https://sandbox.factureaza.ro/api/v1/');
//replace with the api key provided in the backend
define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$invoice_id = 1065253794; // your invoice id here
$changes = array("invoice" =>
array(
"lower_annotation" => 'Explicații noi',
@aphilippi
aphilippi / factureaza_create_proforma_invoice_series.php
Last active February 23, 2019 14:14
Creare serii facturi proforme prin API-ul factureaza.ro
<?php
//set BASE_URL to https://factureaza.ro/api/v1/ for production
define('BASE_URL', 'https://sandbox.factureaza.ro/api/v1/');
//replace with the api key provided in the backend
define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$url = BASE_URL . 'proforma_invoice_series.xml';
$ch = curl_init();
$postdata_with_suffix = '<?xml version="1.0"?>
<proforma_invoice_series>
<?php
//set BASE_URL to https://factureaza.ro/api/v1/ for production
define('BASE_URL', 'https://sandbox.factureaza.ro/api/v1/');
//replace with the api key provided in the backend
define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$invoice_id = 1065253795; // your invoice id here
$url = BASE_URL . 'invoices/' . $invoice_id . '/email.xml' ;
$ch = curl_init();
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
<?php
//set BASE_URL to https://factureaza.ro/api/v1/ for production
define('BASE_URL', 'https://sandbox.factureaza.ro/api/v1/');
//replace with the api key provided in the backend
define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$url = BASE_URL . 'payments/969663447.xml';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x");
<?php
//set BASE_URL to https://factureaza.ro/api/v1/ for production
define('BASE_URL', 'https://sandbox.factureaza.ro/api/v1/');
//replace with the api key provided in the backend
define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$url = BASE_URL . 'products/search.xml?field=price&value=100';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x");
<?php
//set BASE_URL to https://factureaza.ro/api/v1/ for production
define('BASE_URL', 'https://sandbox.factureaza.ro/api/v1/');
//replace with the api key provided in the backend
define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$url = BASE_URL . 'payments/search.xml?field=payment_date&value=2014.06.06';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x");
<?php
//set BASE_URL to https://factureaza.ro/api/ for production
define('BASE_URL', 'https://sandbox.factureaza.ro/api/');
//replace with the api key provided in the backend
define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$url = BASE_URL . 'invoices/search.xml?field=created_at&value=2014.06.06';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, API_KEY . ":x");
@aphilippi
aphilippi / process_callback_post.php
Last active June 4, 2019 11:47
factureaza callback request processing
<?php
// write post parameters to file - sample code for processing the callback after successfull payment
$file_name_json = 'factureaza_callback_post_content.json';
$document_as_json = file_get_contents('php://input');
$fp_json = fopen($file_name_json, 'wt') or die('Could not open file! Make sure you have permission to create the file ' . $file_name_json);
fwrite($fp_json, $document_as_json) or die('Could not write to file! Make sure you have write permission for the file ' . $file_name_json);
fclose($fp_json);
?>
@aphilippi
aphilippi / add_payment_for_invoices.php
Last active February 23, 2019 14:18
Factureaza.ro API: payment examples
<?php
//set BASE_URL to https://factureaza.ro/api/v1/ for production
define('BASE_URL', 'https://sandbox.factureaza.ro/api/v1/');
//replace with the api key provided in the backend
define('API_KEY', '72543f4dc00474bc40a27916d172eb93339fae894ec7a6f2dceb4751d965');
$currency_id = 183; // 183 -> RON
$invoice_id = 1065253795; // your invoice id here
$attributes = array(