Have your agent build an invoice for your country instead of Spain.
Prepare Source
To get started we’re going to need some base data. Take the following yaml, modify as you see fit, and output to a file likeinvoice.yaml:
$schemais set to the GOBL Draft-0 invoice definition.supplieridentifies the issuer of the invoice, and thetax_idspecifically sets the origin country for this invoice.customerincludes the minimum amount of data possible for a customer.linesdefines a simple list of items, including the tax codes, in this case the category is “VAT” at the “standard” rate.- A single discount of “10%” has been defined for the line.
- There are no totals or other calculations, just the basic raw data.
Building
Take the invoice details and send them to thegobl build command:
- Everything has been embedded inside a GOBL Envelope with a header; signatures are added later by
gobl sign. - Each invoice line has been updated with a
sumandtotal, where the total is the sum with discounts applied. - Tax rates valid for the
issue_datehave been added automatically. - A
totalsproperty has been added to the invoice, and details all the taxes that were applied to the calculations made from the lines.
Test PDF
Invopop, the creators of GOBL, offer a free stateless service to be able to test what your invoices look like as a PDFs. We do not recommend this for production use as it does not come with the same service guarantees, but is great for testing. Create a newinvoice.json file: