fast_events_invoice =================== This action is called if the invoice download URL is triggered. Download your own designed invoice possibly using an external financial accounting package. Make sure the right HTTP headers are generated to download a PDF file. .. code-block:: php :linenos: `_. ---- Return ------ None ---- Changelog --------- .. csv-table:: :header: "Version", "Description" :width: 100% :widths: auto "2.1.0", "Introduced." ---- Examples -------- Acumulus invoice ^^^^^^^^^^^^^^^^ Send invoice data to `Acumulus accounting `_. Put your contract information in the snippet and the right template name. Mind you, the snippet doesn't do any error checking. You can find `here `_ the specification how to add an invoice. Once you have submitted the data the return info will give you a token that can be used to retrieve the PDF. You can find `here `_ the specification how to retrieve the PDF. Generate the right download HTTP headers and 'write' the PDF to the standard output. .. code-block:: php :linenos: '; $xml .= ''; $xml .= 'xml'; $xml .= '0'; $xml .= ''; $xml .= 'YOUR_CONTRACT_NUMBER'; $xml .= 'YOUR_USERNAME'; $xml .= 'YOUR_PASSWORD'; $xml .= 'YOUR_EMAIL'; $xml .= 'YOUR_EMAIL'; $xml .= ''; $xml .= ''; $xml .= '' . $attr['invoice']['name'] . ''; $xml .= '' . $attr['invoice']['company'] . ''; $xml .= '' . $attr['invoice']['vat'] . ''; $xml .= '' . $attr['invoice']['street'] . ''; $xml .= '' . $attr['invoice']['postcode'] . ''; $xml .= '' . $attr['invoice']['city'] . ''; $xml .= 'NL'; $xml .= '' . $attr['email'] . ''; $xml .= ''; $xml .= 'Etickets'; $xml .= '2'; $xml .= ''; foreach ( $attr['tickets'] as $key => $value ) { $xml .= ''; $xml .= '' . $value['name'] . ''; $xml .= 'Service'; $price_no_vat = (float) $value['price'] / ( 1 + ( (float) $value['vat'] / 100 ) ); $xml .= '' . number_format( $price_no_vat, 4, '.', '' ) . ''; $xml .= '' . $value['vat'] . ''; $xml .= '' . $value['count'] . ''; $xml .= ''; } $xml .= ''; $xml .= '' . $attr['email'] . ''; $xml .= ''; $xml .= ''; $xml .= ''; $xml .= ''; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://api.sielsystems.nl/acumulus/stable/invoices/invoice_add.php'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_SSLVERSION, 'CURL_SSLVERSION_TLSv1_2'); curl_setopt($ch, CURLOPT_POSTFIELDS, 'xmlstring=' . urlencode($xml)); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_exec($ch); curl_close($ch); } add_action( 'fast_events_invoice', 'your_action_invoice', 10, 1 );