Thanks for the feedback. Here the annotated json. The * indicates the values that need to be sent from OFN:
{
“fecha”: “25/09/2024”, //date, basically today. Not required that it comes from the webhook, it can be done in script or n8n
“hora”: “12:45:00”, //time, basically time. Not required that it comes from the webhook, it can be done in script or n8n
“nif”: “XXXXXXXXX”, // * the business number, ABN in DB
“simplificada”: false, // not related to OFN
“pais_cliente”: “ES”, // that can be hardcoded in the script/n8n
“nombre”: “My Coop”, // * enterprise_name
“direccion”: “Gasteiz”, // * enterprise_address
“cp”: “01013”, // * enterprise_zip_code
“serie”: “A”, // Not required in the webhook. That can be generated in the script/n8n
“numero”: “00003”, // Not required in the webhook. That can be generated in the script/n8n
“rectificativa”: false, //Not required in the webhook.
“clave_rectificativa”: “R1”, //Not required in the webhook.
“tipo_rectificativa”: “I”, // Not required in the webhook.
“rectificadas”: , //Not required in the webhook.
“tipo_operacion”: “servicios”, //Not required in the webhook.
“intracomunitaria”: false, //Not required in the webhook.
“exportacion”: false, //Not required in the webhook.
“retencion”: 0, // Not required in the webhook.
“lineas”: [
{
“descripcion”: “product1”, // * product_name
“cantidad”: 1, // * quantity
“importe_unitario”: 23.2, // * price_per_unit
“tipo_iva”: 0, // * tax type
“tipo_req”: 0 // not applicable
},{
“descripcion”: “product2”, // * product_name
“cantidad”: 2, // * quantity
“importe_unitario”: 2, // * price_per_unit
“tipo_iva”: 0, // * tax_type
“tipo_req”: 0 // not applicable
}
],
“total_factura”: 27.2, // order_total_price to pay
“zuzendu”: false // not applicable
}
To make this webhook more versatile, I suggest triggering it not only when a payment changes from ‘balance due’ to ‘paid,’ but on any status change. Additionally, the updated status should be included to ensure the ability to react appropriately. This approach would enable responses to all status updates.