dev-master
9999999-devFakturoid PHP library
MIT
The Requires
- php >=5.2.0
- ext-curl *
- ext-json *
api invoice fakturoid
Wallogit.com
2017 © Pedro Peláez
PHP library for Fakturoid.cz. Please see API for more documentation. New account just for testing API and using separate user (created via "Nastavení > Uživatelé a oprávnění") for production usage is higly recommended., (*1)
require_once '/path/to/lib/Fakturoid.php';
$f = new Fakturoid('..subdomain..', '..user@email.cz..', '..api_key..', 'PHPlib <your@email.cz>');
// create subject
$subject = $f->create_subject(array('name' => 'Firma s.r.o.', 'email' => 'aloha@pokus.cz'));
// create invoice with lines
$lines = array(array('name' => 'Big sale', 'quantity' => 1, 'unit_price' => 1000));
$invoice = $f->create_invoice(array('subject_id' => $subject->id, 'lines' => $lines));
// send created invoice
$f->fire_invoice($invoice->id, 'deliver');
// to mark invoice as paid
$f->fire_invoice($invoice->id, 'pay'); // or 'pay_proforma' for paying proforma and 'pay_partial_proforma' for partial proforma
Library raises FakturoidException if server returns code 4xx or 5xx. You can get response code and response body by calling getCode() or getMessage()., (*2)
try {
$subject = $f->create_subject(array('name' => '', 'email' => 'aloha@pokus.cz'));
} catch (FakturoidException $e) {
$e->getCode(); // 422
$e->getMessage(); // '{"errors":{"name":["je povinná položka","je příliš krátký/á/é (min. 2 znaků)"]}}'
}
php.ini or call curl_setopt($ch, CURLOPT_CAINFO, "/path/to/cacert.pem")
Fakturoid PHP library
MIT
api invoice fakturoid