Digitizing Spanish Documents: IRPF and RE Support
We are excited to announce a powerful new feature in the CostPocket DIGI API that specifically handles Spanish documents: the extraction of IRPF (Impuesto sobre la Renta de las Personas Físicas) and RE (Recargo de Equivalencia).
These specific tax metrics play an essential role in Spanish invoices and are now effortlessly extractable from both the document's total rows and item lines.
How to Use the Feature
Using this feature is incredibly straightforward. All you need to do is send a `detectSpanishTaxes` flag along with your existing document parsing request.
When formatting your request as
Key:
Value:
When formatting your request as
multipart/form-data, include the field:
Key:
detectSpanishTaxesValue:
true
Here is a Javascript example using Axios:
{
const formData = new FormData()
formData.append("image", file)
formData.append("detectSpanishTaxes", "true")
const response = await axios.post(
"https://digi.costpocket.com/api/document/lines",
formData,
{ headers: { "Authorization": "Bearer your-token-here" }}
)
// Handle response
return response
} Extracted Fields
Once the feature is enabled, DIGI will process the document specifically searching for these local tax numbers and include them in the JSON response under several levels of the receipt hierarchy:
- Global Document level: `irpf` and `re` aggregate numbers.
- Tax rows (`VATRows`): Included on individual tax breakdowns are `irpf`, `irpfRate`, `re`, and `reRate`.
- Item lines (`lines`): When line-item extraction is enabled, the API maps out line-specific `irpf`, `irpfRate`, `re`, and `reRate`.
Example Output
{
"subtotal": "100.00",
"VAT": "21.00",
"re": "5.20",
"irpf": "15.00",
"total": "111.20",
"VATRows": [
{
"subtotal": "100.00",
"VATRate": "21",
"VAT": "21.00",
"reRate": "5.2",
"re": "5.20",
"irpfRate": "15",
"irpf": "15.00",
"total": "111.20"
}
],
"lines": [
{
"comment": "Consulting services",
"amount": "1",
"unitPrice": "100.00",
"subtotal": "100.00",
"VATRate": "21",
"VAT": "21.00",
"reRate": "5.2",
"re": "5.20",
"irpfRate": "15",
"irpf": "15.00",
"total": "111.20"
}
]
}For any questions about setting up your implementation for Spanish taxes, please feel free to reach out to our developers at [email protected].