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 / create_invoice_api_factureaza.php
Last active February 23, 2019 14:20
Factureaza.ro API: add invoice example
<?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');
/* adapt there variables to your needs*/
$client_id = 1064116434;
$currency_id = 183;// 183 -> RON
$invoice_series_id = 1061104069; // IDul seriei - NU PREFIXUL !!!!!
@aphilippi
aphilippi / create_client_api_factureaza.php
Last active February 23, 2019 14:19
Factureaza.ro API: Basic 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');
$attributes = array(
"client" => array(
"name" => 'Firma mea preferata',
"uid" => '3987985',
@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(
@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);
?>
<?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");
<?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/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/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');
$invoice_id = 1065253795; // your invoice id here
$url = BASE_URL . 'invoices/' . $invoice_id . '/email.xml' ;
$ch = curl_init();
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
@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>