Skip to main content

Get a Document Property

Returns one property of a document. Today the only property available is the payment status: whether the document is paid, and how much is still unpaid.

POST https://bo.magnifinance.com/MagniAPI/Invoicing.asmx

Sample Body​

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inv="http://MagniAPI/Invoicing/">
<soapenv:Header/>
<soapenv:Body>
<inv:DocumentGetProperty>
<inv:Authentication>
<inv:Email>api@yourcompany.pt</inv:Email>
<inv:Token>your-subscription-token</inv:Token>
</inv:Authentication>
<inv:DocumentId>72609</inv:DocumentId>
<inv:DocumentProperty>paymentstatus</inv:DocumentProperty>
</inv:DocumentGetProperty>
</soapenv:Body>
</soapenv:Envelope>

Request​

ParameterRequiredValue
Content-Typerequiredtext/xml; charset=utf-8
SOAPActionoptional"http://MagniAPI/Invoicing/DocumentGetProperty"

Authentication​

ParameterRequiredDescription
Emailrequiredstring(50) The email of an API user of your company with permission to read documents. Example: api@yourcompany.pt
Tokenrequiredstring(50) The token of the company (subscription) the document belongs to.

Parameters​

ParameterRequiredDescription
DocumentIdrequiredint The id of the document, as returned by DocumentCreate. Example: 72609
DocumentPropertyrequiredstring The property to read. The only value accepted is paymentstatus (upper or lower case). Any other value returns the error InvalidDocumentProperty.

Response​

The result is in <ResponseDocumentGetProperty> (not <Response>); see Response Format for the fields every response has. Object holds:

ParameterDescription
PaymentStatusstring NoPayment, Incomplete or Complete (see below).
TotalAmountstring The document total, as text in Portuguese format (comma as decimal separator). Example: "69,75"
UnpaidAmountstring How much is still unpaid, in the same format. "0,00" once the document is fully paid, whether through a bank reconciliation or because it was marked as paid. Example: "20,00"

The other fields of this object (DocumentNumber, DownloadUrl, Details) are not filled in here; use DocumentGet for those.

Payment Status Values​

StatusDescription
NoPaymentNo payment has been registered for this document.
IncompletePart of the document has been paid; UnpaidAmount shows the rest.
CompleteThe document is fully paid.

Request Sample​

Save the Sample Body as request.xml, then:

cURL​

curl https://bo.magnifinance.com/MagniAPI/Invoicing.asmx \
--header 'Content-Type: text/xml; charset=utf-8' \
--header 'SOAPAction: "http://MagniAPI/Invoicing/DocumentGetProperty"' \
--data-binary @request.xml

JavaScript (Node.js 18+)​

const fs = require('fs');

const body = fs.readFileSync('request.xml', 'utf8');

fetch('https://bo.magnifinance.com/MagniAPI/Invoicing.asmx', {
method: 'POST',
headers: {
'Content-Type': 'text/xml; charset=utf-8',
SOAPAction: '"http://MagniAPI/Invoicing/DocumentGetProperty"',
},
body,
})
.then((response) => response.text())
.then((xml) => console.log(xml))
.catch((error) => console.error(error));

Example Response​

Success​

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<DocumentGetPropertyResponse xmlns="http://MagniAPI/Invoicing/">
<ResponseDocumentGetProperty>
<RequestId>3f04f766-c3fe-4ede-a399-8f2a0ae1f3dc</RequestId>
<Type>Success</Type>
<Object>
<PaymentStatus>Complete</PaymentStatus>
<TotalAmount>69,75</TotalAmount>
<UnpaidAmount>0,00</UnpaidAmount>
</Object>
</ResponseDocumentGetProperty>
</DocumentGetPropertyResponse>
</soap:Body>
</soap:Envelope>

Error​

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<DocumentGetPropertyResponse xmlns="http://MagniAPI/Invoicing/">
<ResponseDocumentGetProperty>
<RequestId>bd0e8cf2-5bfa-4b4a-9226-e148d1d81e87</RequestId>
<Type>Error</Type>
<ErrorValue>
<Value>24</Value>
<Name>InvalidDocumentProperty</Name>
</ErrorValue>
</ResponseDocumentGetProperty>
</DocumentGetPropertyResponse>
</soap:Body>
</soap:Envelope>