Generate Factur-X Invoices with Lua
Learn how to easily integrate GoFX into your Lua stack.
Dealing with complex XML generation in Lua can be extremely tedious. GoFX abstracts all the EN16931 complexity away. Send a simple JSON payload and get a perfectly compliant hybrid PDF back in milliseconds.
Ecosystem Focus
Integrating Factur-X / EN16931 within the Lua ecosystem is now seamless. Avoid building complex XML DOMs manually and let GoFX handle the heavy lifting. Generate hybrid PDF/A-3 invoices directly via our REST API.
Prerequisites
Ensure you have Lua 5.3+ / lua-http configured in your environment to make outbound HTTP POST requests to the GoFX API.
> Code Example
local http = require("socket.http")
local ltn12 = require("ltn12")
local reqbody = json_payload
local respbody = {}
http.request{
url = "https://api.gofx.app/v1/invoice/generate",
method = "POST",
headers = { ["Content-Type"] = "application/json", ["Content-Length"] = #reqbody },
source = ltn12.source.string(reqbody),
sink = ltn12.sink.table(respbody)
}
local file = io.open("facture.pdf", "wb")
file:write(table.concat(respbody))
file:close()