Send an invoice to FACe using an imported file
Utilizing the B2Brouter API empowers you to seamlessly send invoices to FACe. Let's delve into the process:
- Create an invoice: Begin by importing your invoice document or JSON payload into B2Brouter.
- Verify recipient information: Ensure the recipient details are accurate and complete.
- Sending the invoice: Proceed to send the invoice.
- Track the document: Monitor the traceability of your sent document effortlessly.
To commence, adhere to these instructions:
Creating an Invoice
To create an invoice using our API, consider these options:
- Option 1: JSON Payload:
Utilize a JSON payload to create your issued invoice.
- Option 2: Importing Supported File Format:
This method allows you to import a supported file format. Follow these steps:
# Create an issued invoice by importing a supported file format
curl --location 'https://app.b2brouter.net/projects/{project-id}/invoices/import.json'
--header 'X-B2B-API-KEY: xxxxxxxxxxx'
--header 'Content-Type: application/octet-stream'
--data '@invoice.xml'
Upon importing your invoice document, B2Brouter will generate an invoice object if the document meets standard validation criteria.
Verify recipient information
If it's the first time sending a document to the recipient, a contact will be automatically generated using the data provided in the invoice. If the contact already exists in our public directory, the appropriate delivery method and format for sending invoices will be assigned. You can also check if the recipient exists in our public directory:
# Check our public directory
curl --location 'http://app.b2brouter.net/api/v1/directory/es/9920/ESP2800500G.json'
--header 'X-B2B-API-KEY: xxxxxxxxxxx'
--header 'Content-Type: application/json'
# Sample response
{
"name": "Ayuntamiento de Alcalá de Henares",
"website": "http://www.ayto-alcaladehenares.es",
"address": "Plaza de Cervantes 12",
"city": "Alcalá de Henares",
"postalcode": "28801",
"province": "Madrid",
"country": "es",
"language": "es",
"currency": "EUR",
"tin_scheme": "9920",
"tin_value": "ESP2800500G",
"invoice": {
"transport_type_code": "es.face",
"document_type_code": "xml.facturae.3.2"
},
"routing_codes": {
"cin1_scheme": "8014",
"cin2_scheme": "8014",
"cin3_scheme": "8014",
"cin1_value": "L01280053",
"cin2_value": "L01280053",
"cin3_value": "L01280053"
},
"required_fields": [],
"organizational_units": []
}
You can also edit your client information:
# Update contact
curl --location --request PUT 'http:/app.b2brouter.net/clients/{client-id}.json'
--header 'X-B2B-API-KEY: xxxxxxxxxxx'
--header 'Content-Type: application/json'
--data '{
"client": {
"transport_type_code": "es.face",
"document_type_code": "xml.facturae.3.2"
}
}'
For more detailed information, you can check our code lists for transport types and document types.
There are also some routing fields required for FACe, like DIR3 codes. If they are not provided in the invoice, you will need to add this information updating the recipient.
Send your invoice
The next step is to send the invoice. Before sending, we verify if the invoice contains all the required data. Link to API Reference.
# Send invoice
curl --location --request POST 'http:/app.b2brouter.net/invoices/send_invoice/{invoice-id}.json'
--header 'X-B2B-API-KEY: xxxxxxxxxxx'
--header 'Content-Type: application/json'
If the imported document matches the recipient's transport requirements, such as being a facturaE, and remains unaltered, we'll directly send the original file. Otherwise, we'll generate a document that aligns with the required document type. Additionally, prior to transmission to FACe, we'll verify if the XML is signed; if not, we'll proceed to sign it.
This streamlined process ensures efficient and reliable transmission of invoices to FACe via B2Brouter's API.
Track your invoice
Currently, B2Brouter offers two options for you to monitor the status of your document:
- Option 1: Retrieve events related to a specific invoice.
- Option 2: Check the status of an invoice.
Updated 4 months ago