1. Go to this page and download the library: Download mailercheck/quaderno 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/ */
mailercheck / quaderno example snippets
QuadernoBase::init('YOUR_API_KEY', 'YOUR_API_URL', API_VERSION); // API_VERSION is optional as it defaults to the account API version
QuadernoBase::ping(); // returns true (success) or false (error)
// Simple example to request all pages from the given dates until all invoices have been returned:
$invoices = [];
$filters['limit'] = '50'; // bunches of 50 invoices per request
$filters['date']= "$from,$to"; // please use dates to avoid always getting all invoices
do {
$data = QuadernoInvoice::find($filters);
if (is_array($data) && !empty($data)) {
$invoices = array_merge($invoices, $data);
$last_invoice = end($data); // advances array's internal pointer to the last element, and returns its value
$filters['created_before'] = $last_invoice->id; // paginate from there
}
} while (!empty($data));
$params = array(
'to_country' => 'ES',
'to_postal_code' => '08080'
);
$tax = QuadernoTaxRate::calculate($params); // returns a QuadernoTax
$tax->name; // 'IVA'
$tax->rate; // 21.0
// A non-processable request (due to invalid data, outages, etc.) returns false boolean
QuadernoBase::init('fakeApiKey', 'https://fake-subdomain.quadernoapp.com/api/');
$tax = QuadernoTaxRate::calculate($params);
$tax // false
// Example using a callback to get the specific error response
$tax = QuadernoTaxRate::calculate($params, function($apiErrorResponse) use (&$errorResponse) {
$errorResponse = $apiErrorResponse;
});
$tax; // false
$errorResponse['http_code']; // 401
$errorResponse['data']['error']; // "Wrong API key or the user does not exist."