Turkish e-Invoice Builder
tr_invoice_buildBuilds a UBL-TR e-Invoice or e-Archive XML document from plain JSON, computing every total and validating the parties.
Selling into Türkiye means issuing a UBL-TR document whose element order is fixed by schema and whose totals must agree to the kuruş, or the integrator rejects it. This endpoint takes the invoice as ordinary JSON and returns the XML. Totals you send are ignored on purpose — line amounts, per-rate VAT subtotals and the payable amount are all recomputed here, because a rounding difference of one kuruş is the most common rejection. VKN and TCKN checksums are verified, and the amount is written out in Turkish words as invoices require. It does not sign the document and does not transmit it: the financial seal and the submission to the tax authority belong to your certificate and your integrator. What comes back is a document ready to enter that step.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Invoice number. Omit and supply `series` to have it built from the series and sequence. | |
| uuid | No | Document UUID (ETTN). Generated when omitted. | |
| lines | Yes | ||
| notes | No | ||
| series | No | Three-letter series code, used with `sequence`. | |
| profile | No | TEMELFATURA: no formal objection flow. TICARIFATURA: buyer may accept/reject. EARSIVFATURA: buyer is not an e-Invoice user. | TEMELFATURA |
| currency | No | ISO 4217. Anything other than TRY requires `exchangeRate`. | TRY |
| customer | Yes | ||
| sequence | No | Sequence number within the series and year. | |
| supplier | Yes | ||
| issueDate | Yes | ||
| issueTime | No | ||
| exchangeRate | No | Units of TRY per one unit of `currency`. | |
| amountInWords | No | Adds the payable amount written out in Turkish words as a note, the way invoices require. | |
| invoiceTypeCode | No | SATIS | |
| orderReferenceId | No | ||
| despatchDocumentId | No | Delivery note number, if the goods shipped separately. |