# Receive invoices

Requirement: Tutorial: Connect your application

# Step 1: Check for new invoices

Use the call GetInboxDocuments with document filter on creation date (CreatedOn) and receive the list of new documents. Store the highest CreatedOn value as basis for the next check. For selecting the right document you must use a MastertemplateId.

<?xml version="1.0" encoding="utf-8"?>
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
  <Body>
    <GetInboxDocuments xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://api.everbinding.nl/v3/">
      <EConnectPartyId>XCLN10019</EConnectPartyId>
    <Search>
        <CreatedOn>
            <!-- highest CreatedOn value of previous call -->
            <From>2016-11-01T01:01:01.0000000+00:00</From>
        </CreatedOn>
        <Template>
            <Id>GLDT9223370666504283001RA000000006DTP2000001</Id>
        </Template>
    </Search>
    </GetInboxDocuments>
  </Body>
</Envelope>

# Step 2: Download the inbox documents

Use the call GetInboxDocument to download the XML file for each document in the list of step 1. From the response of the GetInboxDocuments the ExternalId must be used for getting the document. A document in Inbox or Outbox can get a revision. This means the ExternalId will be the same as the original document.

The PDF attachment is optional*. To be sure to always get a PDF, use the call GetDocumentPdf; this call will return the embedded PDF if available in the XML or the PDF of this XML document which will be generated by the platform.

*We wil generate a PDF by default when this is not available in the XML, so it will be always available in the XML.

# Step 3: Download the outbox documents

Also the documents from the outbox can be downloaded. This way one CRM system can send invoices with the SendDocument call, while another financial system can download the sales invoices via the GetOutboxDocuments and GetOutboxDocument to process them in the administration.

# Get status of send invoices

In most cases the documents in the outbox are the documents send via the SendDocument call. In this situation it can be useful to retrieve the document information. With the status you can see that the document is read or processed. For retrieving all documents with the changed status use the ModifiedOn date in your filter while using the GetOutboxDocuments call. Use the highest ModifiedOn returned in the last call as start for new search for changed documents.

<?xml version="1.0" encoding="utf-8"?>
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
  <Body>
    <GetOutboxDocuments xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://api.everbinding.nl/v3/">
      <EConnectPartyId>XCLN10019</EConnectPartyId>
    <Search>
        <ModifiedOn>
            <!-- highest ModifiedOn value of previous call AddMilliseconds(4)-->
            <From>2016-11-01T01:01:01.0000000+00:00</From>
        </ModifiedOn>
        <Template>
            <Id>GLDT9223370666504283001RA000000006DTP2000001</Id>
        </Template>
    </Search>
    </GetOutboxDocuments>
  </Body>
</Envelope>
© 2024 eConnect International B.V.