Send a document (invoice, quotation, ...) to the customer via BPost. For this, the link with Mail-IT-Wize must first be set up.
Use the POST method with, for example, https://api.simplybooks/api/v1/invoices/1001?send_postalmail as the URL.
You do have to provide some additional information (in XML, JSON or form-encoding):
- address_type (text): Address type from which the address data is retrieved. Possible values: "billing" (=standard billing data), "delivery" (=shipping address), "site" (=site address).
- send_registered (int): "0" for ordinary consignments; "1" for registered mail.
- document_type: Type of document. Only applicable when sending an invoice. Can contain the following values: 'pdf', 'duplicate', 'reminder', 'reminder_summary'. If not specified, 'pdf' is used.
An example in XML to pass on your data:
<data> <address_type>billing</address_type> <send_registered>0</send_registered> </data>
An example in PHP how an invoice can be sent via BPost:
$email = '[email protected]'; $password = '123456'; $post = ['address_type' => 'billing', 'send_registered' => 0]; $p = curl_init('https://eenvoudigfactureren.be/api/v1/invoices/1001?send_postalmail'); curl_setopt($p, CURLOPT_USERPWD, $email . ':' . $password); curl_setopt($p, CURLOPT_POSTFIELDS, $post); curl_setopt($p, CURLOPT_RETURNTRANSFER, TRUE); $result_in_xml_string = curl_exec($p);
More info about API? Read useful articles below