Class GibInvoiceQrCode
- Namespace
- HeroKit.Globalization.Turkey
- Assembly
- HeroKit.dll
The content of the QR code (karekod) printed on a Turkish e-Fatura or e-Arşiv invoice, in the GİB JSON format.
public sealed class GibInvoiceQrCode
- Inheritance
-
GibInvoiceQrCode
- Inherited Members
- Extension Methods
Examples
if (GibInvoiceQrCode.TryParse(scannedText, out GibInvoiceQrCode? qr))
{
qr.Number.ToString(); // "ABC2026000000001"
qr.PayableAmount; // 120.00
qr.VatAmounts[20m]; // 20.00
}
Remarks
The QR code holds a flat JSON object such as
{"vkntckn":"4840847211","avkntckn":"11111111111","senaryo":"EARSIVFATURA","tip":"SATIS","tarih":"2026-10-15","no":"ABC2026000000001","ettn":"51d3bb18-9650-4c8e-825d-5a7f845be630","parabirimi":"TRY","malhizmettoplam":"100.00","kdvmatrah(20)":"100.00","hesaplanankdv(20)":"20.00","vergidahil":"120.00","odenecek":"120.00"}.
TryParse(string?, out GibInvoiceQrCode?) checks the fields that identify the invoice: the seller VKN or TCKN, the buyer VKN or TCKN ("11111111111" for e-Arşiv buyers without one), the invoice number, the ETTN and the date. Amounts are optional. The method reads the text only; it does not ask GİB whether the invoice exists.
Properties
BuyerTaxId
Gets the VKN or TCKN of the buyer ("avkntckn").
public required string BuyerTaxId { get; init; }
Property Value
CurrencyCode
Gets the ISO 4217 currency code ("parabirimi"), for example "TRY", or null.
public string? CurrencyCode { get; }
Property Value
Date
Gets the invoice date ("tarih").
public required DateOnly Date { get; init; }
Property Value
Ettn
Gets the ETTN ("ettn").
public required Guid Ettn { get; init; }
Property Value
Fields
Gets every field of the QR code as text, with keys in lower case.
public IReadOnlyDictionary<string, string> Fields { get; }
Property Value
InvoiceType
Gets the invoice type ("tip"), for example "SATIS" or "IADE", or null.
public string? InvoiceType { get; }
Property Value
LineTotal
Gets the total of goods and services before tax ("malhizmettoplam"), or null.
public decimal? LineTotal { get; }
Property Value
Number
Gets the invoice number ("no").
public required GibInvoiceNumber Number { get; init; }
Property Value
PayableAmount
Gets the amount to pay ("odenecek"), or null.
public decimal? PayableAmount { get; }
Property Value
Scenario
Gets the scenario ("senaryo"), for example "TEMELFATURA", "TICARIFATURA" or "EARSIVFATURA", or null.
public string? Scenario { get; }
Property Value
SellerTaxId
Gets the VKN or TCKN of the seller ("vkntckn").
public required string SellerTaxId { get; init; }
Property Value
TaxInclusiveTotal
Gets the total including taxes ("vergidahil"), or null.
public decimal? TaxInclusiveTotal { get; }
Property Value
VatAmounts
Gets the calculated VAT per VAT rate ("hesaplanankdv(20)" → 20).
public IReadOnlyDictionary<decimal, decimal> VatAmounts { get; }
Property Value
VatBases
Gets the VAT base per VAT rate ("kdvmatrah(20)" → 20).
public IReadOnlyDictionary<decimal, decimal> VatBases { get; }
Property Value
Methods
TryParse(string?, out GibInvoiceQrCode?)
Reads the JSON text of an e-Fatura or e-Arşiv QR code.
public static bool TryParse(string? json, out GibInvoiceQrCode? result)
Parameters
jsonstringThe text read from the QR code.
resultGibInvoiceQrCodeThe QR code content when the method returns true; otherwise null.
Returns
- bool
True if the text is a JSON object with a valid seller and buyer tax id, invoice number, ETTN and date.