Welcome to the system documentation. Select a topic from the sidebar to learn more.

Quick Start

Get up and running quickly with our step-by-step guides.

Get Started

Video Tutorials

Watch our video tutorials to see the system in action.

Watch Videos

C# Code Samples of Reporting Api - Documentation

About These Samples- Sample 01

This page demonstrates various ZATCA simplified invoice reporting scenarios with ready-to-use JSON samples. Additionally, we provided c# code to implement each scenario

Basic Simplified Invoice

A minimal simplified invoice with one standard-rated item (15% VAT).

{
                UnitId = "TST-C22FF20EFD-DIANA152",
                InvoiceNo = "000102",
                DocType = "SIMPLIFIED",
                DocForm = "INVOICE",
                IssueDate = DateTime.Now.ToString("yyyy-MM-dd"),
                IssueTime = DateTime.Now.ToString("HH:mm:ss"),
                DocCurrency = "SAR",
                PaymentMethod = "Cash",
                CustomerName = "Cash Customer",
                InvoiceLines = new List
                {
                    new InvoiceLineDto
                    {
                        LineNo = 1,
                        ItemName = "Laptop Dell Latitude E5450",
                        Quantity = 1,
                        UnitCode = "NOS",
                        TaxCategory = "S",
                        TaxRate = 15,
                        ItemPrice = 750,
                        Currency = "SAR"
                    }
                }
            };

Invoice with Document-Level Allowances-Sample 02

An invoice with document-level discounts and charges applied to the total amount.

{
  "UnitId": "TST-C22FF20EFD-DIANA152",
  "InvoiceNo": "INV-2023-002",
  "DocType": "SIMPLIFIED",
  "DocForm": "INVOICE",
  "Note": "Invoice with document-level allowances",
  "IssueDate": "2025-08-14",
  "IssueTime": "18:05:00",
  "DocCurrency": "SAR",
  "PaymentMethod": "CreditCard",
  "CustomerName": "Cash Customer",
  "AllowanceCharges": [
    {
      "Type": "ALLOWANCE",
      "Reason": "Seasonal Discount",
      "Amount": 50.00,
      "TaxRate": 15.00,
      "TaxCategory": "S"
    },
    {
      "Type": "CHARGE",
      "Reason": "Delivery Fee",
      "Amount": 20.00,
      "TaxRate": 15.00,
      "TaxCategory": "S"
    }
  ],
  "InvoiceLines": [
    {
      "LineNo": 1,
      "ItemName": "Premium Laptop",
      "Quantity": 2,
      "UnitCode": "NOS",
      "TaxCategory": "S",
      "TaxRate": 15,
      "ItemPrice": 2500,
      "Currency": "SAR"
    }
  ]
}

Mixed Tax Categories Invoice- Sample 03

An invoice containing items with different tax categories (Standard, Zero-rated, and Exempt).

{
  "UnitId": "TST-C22FF20EFD-DIANA152",
  "InvoiceNo": "INV-2023-003",
  "DocType": "SIMPLIFIED",
  "DocForm": "INVOICE",
  "IssueDate": "2025-08-14",
  "IssueTime": "18:45:00",
  "DocCurrency": "SAR",
  "PaymentMethod": "BankTransfer",
  "CustomerName": "Cash Customer",
  "InvoiceLines": [
    {
      "LineNo": 1,
      "ItemName": "Consulting Services",
      "Quantity": 10,
      "UnitCode": "HUR",
      "TaxCategory": "S",
      "TaxRate": 15,
      "ItemPrice": 200,
      "Currency": "SAR"
    },
    {
      "LineNo": 2,
      "ItemName": "Export Goods",
      "Quantity": 2,
      "UnitCode": "BOX",
      "TaxCategory": "Z",
      "TaxRate": 0,
      "ItemPrice": 500,
      Currency = "SAR",
      VatExemptionCode = "VATEX-SA-34-4",
      VatExemptionReason = "Supply of a qualifying means of transport" 
    },
    {
      "LineNo": 3,
      "ItemName": "Educational Books",
      "Quantity": 15,
      "UnitCode": "PCE",
      "TaxCategory": "E",
      "TaxRate": 0,
      "ItemPrice": 50,
      "Currency": "SAR",
      "VatExemptionCode": "VATEX-SA-EDU",
      "VatExemptionReason": "Educational materials exempt under VAT regulations"
    }
  ]
}

Credit Note with Reference - Sample 04

A credit note referencing the original invoice being credited.

{
  "UnitId": "TST-C22FF20EFD-DIANA152",
  "InvoiceNo": "CN-2023-004",
  "DocType": "SIMPLIFIED",
  "DocForm": "CREDITNOTE",
  "Note": "Return of defective goods",
  "IssueDate": "2025-08-14",
  "IssueTime": "18:50:00",
  "DocCurrency": "SAR",
  "PaymentMethod": "Credit",
  "CustomerName": "Cash Customer",
  "PreviousInvoiceRef": "INV-2023-045",
  "InvoiceLines": [
    {
      "LineNo": 1,
      "ItemName": "Defective Smartphone",
      "Quantity": 1,
      "UnitCode": "PCE",
      "TaxCategory": "S",
      "TaxRate": 15,
      "ItemPrice": 1200,
      "Currency": "SAR"
    }
  ]
}

Debit Note with Reference - Sample 05

A debit note referencing the original invoice being debited.

{
  "UnitId": "TST-C22FF20EFD-DIANA152",
  "InvoiceNo": "DN-2023-005",
  "DocType": "SIMPLIFIED",
  "DocForm": "DEBITNOTE",
  "Note": "Return of defective goods",
  "IssueDate": "2025-08-14",
  "IssueTime": "18:53:00",
  "DocCurrency": "SAR",
  "PaymentMethod": "DebitTransfer",
  "CustomerName": "Cash Customer",
  "PreviousInvoiceRef": "INV-2023-045",
  "InvoiceLines": [
    {
      "LineNo": 1,
      "ItemName": "Smartphone",
      "Quantity": 1,
      "UnitCode": "PCE",
      "TaxCategory": "S",
      "TaxRate": 15,
      "ItemPrice": 1200,
      "Currency": "SAR"
    }
  ]
}

Invoice with Line-Level Allowances - Sample 06

An invoice with discounts applied at the line-item level.

{
  "UnitId": "TST-C22FF20EFD-DIANA152",
  "InvoiceNo": "INV-2023-006",
  "DocType": "SIMPLIFIED",
  "DocForm": "INVOICE",
  "IssueDate": "2025-08-14",
  "IssueTime": "18:56:00",
  "DocCurrency": "SAR",
  "PaymentMethod": "Cash",
  "CustomerName": "Cash Customer",
  "InvoiceLines": [
    {
      "LineNo": 1,
      "ItemName": "Office Chair",
      "Quantity": 5,
      "UnitCode": "PCE",
      "TaxCategory": "S",
      "TaxRate": 15,
      "ItemPrice": 300,
      "Currency": "SAR",
      "AllowanceCharges": [
        {
          "Type": "ALLOWANCE",
          "Reason": "Volume discount",
          "Amount": 50
        },
        {
          "Type": "ALLOWANCE",
          "Reason": "Promotional discount",
          "Amount": 25
        }
      ]
    }
  ]
}

Sample with full json attrbutes set - Sample 07

This sample was not implemented in code. given here for your reference only

{
  "UnitId": "TST-C22FF20EFD-DIANA152",
  "InvoiceNo": "000101",
  "DocType": "SIMPLIFIED",
  "DocForm": "INVOICE",
  "Note": "Direct Customer Sale",
  "IssueDate": "2025-07-17",
  "IssueTime": "03:06:14",
  "DocCurrency": "SAR",
  "ActualDelivery": "2025-07-17",
  "LatestDelivery": "2025-07-17",
  "PaymentMethod": "Cash",
  "CustomerName": "Cash Customer",
  "PreviousInvoiceRef": "INV-00020",
  "AllowanceCharges": [
    {
      "Type": "ALLOWANCE",
      "Reason": "Seasonal Discount",
      "Amount": 1,
      "TaxRate": 15,
      "TaxCategory": "S"
    },
    {
      "Type": "CHARGE",
      "Reason": "Shipping Charge",
      "Amount": 2,
      "TaxRate": 15,
      "TaxCategory": "S"
    }
  ],
  "InvoiceLines": [
    {
      "LineNo": 1,
      "ItemName": "Documentation Charges",
      "Quantity": 1,
      "UnitCode": "NOS",
      "TaxCategory": "E",
      "TaxRate": 0,
      "ItemPrice": 750,
      "Currency": "SAR",
      "BaseQuantity": 1,
      "BaseUnitCode": "NOS",
      "VatExemptionCode": "VATEX-SA-29",
      "VatExemptionReason": "Financial services mentioned in Article 29 of the VAT Regulations",
      "AllowanceCharges": [
        {
          "Type": "ALLOWANCE",
          "Reason": "stock clearance",
          "Amount": 5
        }
      ]
    },
    {
      "LineNo": 2,
      "ItemName": "Laptop Dell Latitude E5450",
      "Quantity": 1,
      "UnitCode": "NOS",
      "TaxCategory": "S",
      "TaxRate": 15,
      "ItemPrice": 850,
      "Currency": "SAR",
      "BaseQuantity": 1,
      "BaseUnitCode": "NOS",
      "AllowanceCharges": [
        {
          "Type": "CHARGE",
          "Reason": "shipping charge",
          "Amount": 5
        }
      ]
    }
  ],
  "PrePayments": [
    {
      "Amount": 10,
      "Quantity": 1,
      "UnitCode": "PCE",
      "ItemName": "Laptop Charger",
      "TaxCategory": "S",
      "Rate": "15",
      "Currency": "SAR",
      "BaseQuantity": 1,
      "BaseUnit": "PCE",
      "PrePaidInvoiceNo": "000454",
      "PrePaidInvoiceIssueDate": "2025-07-17",
      "PrePaidInvoiceIssueTime": "06:08:14"
    }
  ]
}


C# Code samples

Input and Output Data Objects

Samples provide all neccessary classes to implement invoice objects

public class SimplifiedInvoiceDto
    {
        public string UnitId { get; set; }
        public string InvoiceNo { get; set; }
        public string DocType { get; set; }
        public string DocForm { get; set; }
        public string Note { get; set; }
        public string IssueDate { get; set; }
        public string IssueTime { get; set; }
        public string DocCurrency { get; set; }
        public string ActualDelivery { get; set; }
        public string LatestDelivery { get; set; }
        public string PaymentMethod { get; set; }
        public string CustomerName { get; set; }
        public string PreviousInvoiceRef { get; set; }
        public List AllowanceCharges { get; set; } = new List();
        public List InvoiceLines { get; set; } = new List();
        public List PrePayments { get; set; } = new List();
    }

    public class InvoiceAllowanceChargeDto
    {
        public string Type { get; set; }
        public string Reason { get; set; }
        public decimal Amount { get; set; }
        public decimal TaxRate { get; set; }
        public string TaxCategory { get; set; }
    }

    public class InvoiceLineDto
    {
        public int LineNo { get; set; }
        public string ItemName { get; set; }
        public decimal Quantity { get; set; }
        public string UnitCode { get; set; }
        public string TaxCategory { get; set; }
        public decimal TaxRate { get; set; }
        public decimal ItemPrice { get; set; }
        public string Currency { get; set; }
        public decimal BaseQuantity { get; set; }
        public string BaseUnitCode { get; set; }
        public string VatExemptionCode { get; set; }
        public string VatExemptionReason { get; set; }
       
        public List AllowanceCharges { get; set; } = new List();
    }

    public class InvoiceLineAllowanceChargeDto
    {
        public string Type { get; set; }
        public string Reason { get; set; }
        public decimal Amount { get; set; }
    }

    public class PrePaymentsDto
    {
        public decimal Amount { get; set; }
        public decimal Quantity { get; set; }
        public string UnitCode { get; set; }
        public string ItemName { get; set; }
        public string TaxCategory { get; set; }
        public string Rate { get; set; }
        public string Currency { get; set; }
        public decimal BaseQuantity { get; set; }
        public string BaseUnit { get; set; }
        public string PrePaidInvoiceNo { get; set; }
        public string PrePaidInvoiceIssueDate { get; set; }
        public string PrePaidInvoiceIssueTime { get; set; }
    }

    public class ZatcaApiResponse
    {
        public string Status { get; set; }
        public string Message { get; set; }
        public string Icv { get; set; }
        public string Hash { get; set; }
        public string Uuid { get; set; }
        public string QrCodeValue { get; set; }
    }

Sample code of creating Invoice objects in each scenario

Samples provide all neccessary classes to implement invoice objects

public class ZatcaApiClient
    {
        private readonly HttpClient _httpClient;
        private readonly string _baseUrl;
        private readonly string _jwtToken;

        public ZatcaApiClient(string baseUrl, string jwtToken)
        {
            _baseUrl = baseUrl ?? throw new ArgumentNullException(nameof(baseUrl));
            _jwtToken = jwtToken ?? throw new ArgumentNullException(nameof(jwtToken));

            _httpClient = new HttpClient();
            _httpClient.DefaultRequestHeaders.Authorization =
                new AuthenticationHeaderValue("Bearer", _jwtToken);
        }

        public async Task ReportSimplifiedInvoice(SimplifiedInvoiceDto invoice)
        {
            var endpoint = $"{_baseUrl}/api/ZatcaIntegration/ReportInvoice";

            var jsonContent = JsonConvert.SerializeObject(invoice);
            var httpContent = new StringContent(jsonContent, Encoding.UTF8, "application/json");

            var response = await _httpClient.PostAsync(endpoint, httpContent);

            if (!response.IsSuccessStatusCode)
            {
                var errorContent = await response.Content.ReadAsStringAsync();
                throw new HttpRequestException($"API call failed with status code {response.StatusCode}. Response: {errorContent}");
            }

            var responseContent = await response.Content.ReadAsStringAsync();
            if (!response.IsSuccessStatusCode)
            {
                throw new HttpRequestException($"API call failed with status code {response.StatusCode}. Response: {responseContent}");
            }

            return JsonConvert.DeserializeObject(responseContent);

        }

        // Sample invoice creation methods – Sample 01
        public SimplifiedInvoiceDto CreateBasicInvoice()
        {
            return new SimplifiedInvoiceDto
            {
                UnitId = "TST-C22FF20EFD-DIANA152",
                InvoiceNo = "000102",
                DocType = "SIMPLIFIED",
                DocForm = "INVOICE",
                IssueDate = DateTime.Now.ToString("yyyy-MM-dd"),
                IssueTime = DateTime.Now.ToString("HH:mm:ss"),
                DocCurrency = "SAR",
                PaymentMethod = "Cash",
                CustomerName = "Cash Customer",
                InvoiceLines = new List
                {
                    new InvoiceLineDto
                    {
                        LineNo = 1,
                        ItemName = "Laptop Dell Latitude E5450",
                        Quantity = 1,
                        UnitCode = "NOS",
                        TaxCategory = "S",
                        TaxRate = 15,
                        ItemPrice = 750,
                        Currency = "SAR"
                    }
                }
            };
        }

        // Sample invoice creation methods – Sample 02
        public SimplifiedInvoiceDto CreateInvoiceWithDocumentAllowances()
        {
            return new SimplifiedInvoiceDto
            {
                UnitId = "TST-C22FF20EFD-DIANA152",
                InvoiceNo = "INV-2023-002",
                DocType = "SIMPLIFIED",
                DocForm = "INVOICE",
                Note = "Invoice with document-level allowances",
                IssueDate = DateTime.Now.ToString("yyyy-MM-dd"),
                IssueTime = DateTime.Now.ToString("HH:mm:ss"),
                DocCurrency = "SAR",
                PaymentMethod = "CreditCard",
                CustomerName = "Cash Customer",
                AllowanceCharges = new List
                {
                    new InvoiceAllowanceChargeDto
                    {
                        Type = "ALLOWANCE",
                        Reason = "Seasonal Discount",
                        Amount = 50.00m,
                        TaxRate = 15.00m,
                        TaxCategory = "S"
                    },
                    new InvoiceAllowanceChargeDto
                    {
                        Type = "CHARGE",
                        Reason = "Delivery Fee",
                        Amount = 20.00m,
                        TaxRate = 15.00m,
                        TaxCategory = "S"
                    }
                },
                InvoiceLines = new List
                {
                    new InvoiceLineDto
                    {
                        LineNo = 1,
                        ItemName = "Premium Laptop",
                        Quantity = 2,
                        UnitCode = "NOS",
                        TaxCategory = "S",
                        TaxRate = 15,
                        ItemPrice = 2500,
                        Currency = "SAR"
                    }
                }
            };
        }

        // Sample invoice creation methods – Sample 03

        public SimplifiedInvoiceDto CreateMixedTaxInvoice()
        {
            return new SimplifiedInvoiceDto
            {
                UnitId = "TST-C22FF20EFD-DIANA152",
                InvoiceNo = "INV-2023-003",
                DocType = "SIMPLIFIED",
                DocForm = "INVOICE",
                IssueDate = DateTime.Now.ToString("yyyy-MM-dd"),
                IssueTime = DateTime.Now.ToString("HH:mm:ss"),
                DocCurrency = "SAR",
                PaymentMethod = "BankTransfer",
                CustomerName = "Cash Customer",
                InvoiceLines = new List
                {
                    new InvoiceLineDto // Standard rated
                    {
                        LineNo = 1,
                        ItemName = "Consulting Services",
                        Quantity = 10,
                        UnitCode = "HUR",
                        TaxCategory = "S",
                        TaxRate = 15,
                        ItemPrice = 200,
                        Currency = "SAR"
                    },
                    new InvoiceLineDto // Zero-rated
                    {
                        LineNo = 2,
                        ItemName = "Export Goods",
                        Quantity = 2,
                        UnitCode = "BOX",
                        TaxCategory = "Z",
                        TaxRate = 0,
                        ItemPrice = 500,
                        Currency = "SAR"
                    },
                    new InvoiceLineDto // Exempt
                    {
                        LineNo = 3,
                        ItemName = "Educational Books",
                        Quantity = 15,
                        UnitCode = "PCE",
                        TaxCategory = "E",
                        TaxRate = 0,
                        ItemPrice = 50,
                        Currency = "SAR",
                        VatExemptionCode = "VATEX-SA-EDU",
                        VatExemptionReason = "Educational materials exempt under VAT regulations"
                    }
                }
            };
        }

        // Sample invoice creation methods – Sample 04
        public SimplifiedInvoiceDto CreateCreditNote()
        {
            return new SimplifiedInvoiceDto
            {
                UnitId = "TST-C22FF20EFD-DIANA152",
                InvoiceNo = "CN-2023-004",
                DocType = "SIMPLIFIED",
                DocForm = "CREDITNOTE",
                Note = "Return of defective goods",
                IssueDate = DateTime.Now.ToString("yyyy-MM-dd"),
                IssueTime = DateTime.Now.ToString("HH:mm:ss"),
                DocCurrency = "SAR",
                PaymentMethod = "Credit",
                CustomerName = "Cash Customer",
                PreviousInvoiceRef = "INV-2023-045",
                InvoiceLines = new List
                {
                    new InvoiceLineDto
                    {
                        LineNo = 1,
                        ItemName = "Defective Smartphone",
                        Quantity = 1,
                        UnitCode = "PCE",
                        TaxCategory = "S",
                        TaxRate = 15,
                        ItemPrice = 1200,
                        Currency = "SAR"
                    }
                }
            };
        }

        // Sample invoice creation methods – Sample 05
        public SimplifiedInvoiceDto CreateDebitNote()
        {
            return new SimplifiedInvoiceDto
            {
                UnitId = "TST-C22FF20EFD-DIANA152",
                InvoiceNo = "DN-2023-005",
                DocType = "SIMPLIFIED",
                DocForm = "DEBITNOTE",
                Note = "Return of defective goods",
                IssueDate = DateTime.Now.ToString("yyyy-MM-dd"),
                IssueTime = DateTime.Now.ToString("HH:mm:ss"),
                DocCurrency = "SAR",
                PaymentMethod = "DebitTransfer",
                CustomerName = "Cash Customer",
                PreviousInvoiceRef = "INV-2023-045",
                InvoiceLines = new List
                {
                    new InvoiceLineDto
                    {
                        LineNo = 1,
                        ItemName = " Smartphone",
                        Quantity = 1,
                        UnitCode = "PCE",
                        TaxCategory = "S",
                        TaxRate = 15,
                        ItemPrice = 1200,
                        Currency = "SAR"
                    }
                }
            };
        }


        // Sample invoice creation methods – Sample 06
        public SimplifiedInvoiceDto CreateInvoiceWithLineAllowances()
        {
            return new SimplifiedInvoiceDto
            {
                UnitId = "TST-C22FF20EFD-DIANA152",
                InvoiceNo = "INV-2023-006",
                DocType = "SIMPLIFIED",
                DocForm = "INVOICE",
                IssueDate = DateTime.Now.ToString("yyyy-MM-dd"),
                IssueTime = DateTime.Now.ToString("HH:mm:ss"),
                DocCurrency = "SAR",
                PaymentMethod = "Cash",
                CustomerName = "Cash Customer",
                InvoiceLines = new List
                {
                    new InvoiceLineDto
                    {
                        LineNo = 1,
                        ItemName = "Office Chair",
                        Quantity = 5,
                        UnitCode = "PCE",
                        TaxCategory = "S",
                        TaxRate = 15,
                        ItemPrice = 300,
                        Currency = "SAR",
                        AllowanceCharges = new List
                        {
                            new InvoiceLineAllowanceChargeDto
                            {
                                Type = "ALLOWANCE",
                                Reason = "Volume discount",
                                Amount = 50
                            },
                            new InvoiceLineAllowanceChargeDto
                            {
                                Type = "ALLOWANCE",
                                Reason = "Promotional discount",
                                Amount = 25
                            }
                        }
                    }
                }
            };
        }


        // Sample invoice creation methods – Sample 07
        public SimplifiedInvoiceDto CreateInvoiceWithPrePaymentsAndMixedItems()
        {
            return new SimplifiedInvoiceDto
            {
                UnitId = "TST-C22FF20EFD-DIANA152",
                InvoiceNo = "000101",
                DocType = "SIMPLIFIED",
                DocForm = "INVOICE",
                Note = "Direct Customer Sale",
                IssueDate = "2025-07-17",
                IssueTime = "03:06:14",
                DocCurrency = "SAR",
                ActualDelivery = "2025-07-17",
                LatestDelivery = "2025-07-17",
                PaymentMethod = "Cash",
                CustomerName = "Cash Customer",
                PreviousInvoiceRef = "INV-00020",
                AllowanceCharges = new List
        {
            new InvoiceAllowanceChargeDto
            {
                Type = "ALLOWANCE",
                Reason = "Seasonal Discount",
                Amount = 1,
                TaxRate = 15,
                TaxCategory = "S"
            },
            new InvoiceAllowanceChargeDto
            {
                Type = "CHARGE",
                Reason = "Shipping Charge",
                Amount = 2,
                TaxRate = 15,
                TaxCategory = "S"
            }
        },
                InvoiceLines = new List
        {
            new InvoiceLineDto
            {
                LineNo = 1,
                ItemName = "Documentation Charges",
                Quantity = 1,
                UnitCode = "NOS",
                TaxCategory = "E",
                TaxRate = 0,
                ItemPrice = 750,
                Currency = "SAR",
                BaseQuantity = 1,
                BaseUnitCode = "NOS",
                VatExemptionCode = "VATEX-SA-29",
                VatExemptionReason = "Financial services mentioned in Article 29 of the VAT Regulations",
                AllowanceCharges = new List
                {
                    new InvoiceLineAllowanceChargeDto
                    {
                        Type = "ALLOWANCE",
                        Reason = "stock clearance",
                        Amount = 5
                    }
                }
            },
            new InvoiceLineDto
            {
                LineNo = 2,
                ItemName = "Laptop Dell Latitude E5450",
                Quantity = 1,
                UnitCode = "NOS",
                TaxCategory = "S",
                TaxRate = 15,
                ItemPrice = 850,
                Currency = "SAR",
                BaseQuantity = 1,
                BaseUnitCode = "NOS",
                AllowanceCharges = new List
                {
                    new InvoiceLineAllowanceChargeDto
                    {
                        Type = "CHARGE",
                        Reason = "shipping charge",
                        Amount = 5
                    }
                }
            }
        },
                PrePayments = new List
        {
            new PrePaymentsDto
            {
                Amount = 10,
                Quantity = 1,
                UnitCode = "PCE",
                ItemName = "Laptop Charger",
                TaxCategory = "S",
                Rate = "15",
                Currency = "SAR",
                BaseQuantity = 1,
                BaseUnit = "PCE",
                PrePaidInvoiceNo = "000454",
                PrePaidInvoiceIssueDate = "2025-07-17",
                PrePaidInvoiceIssueTime = "06:08:14"
            }
        }
            };
        }
    }

Code samples of calling Simplified invoice reporting API's'

Samples provides Consple applicate code to run API

public class Program
{
    public static async Task Main(string[] args)
    {
        const string apiBaseUrl = "https://www.pristineinvoice.com";
        const string jwtToken = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImRpYW5hZ3VuYXdhcmRhbmEiLCJuYW1laWQiOiI5YzcxMzk1YS03ODBjLTQwOWYtYmYxNy01MDhlMzFkMDEwM2UiLCJlbWFpbCI6ImRpYW5hZ3VuYXdhcmRhbmFAZ21haWwuY29tIiwiVGVuYW50SWQiOiJDMjJGRjIwRUZEIiwiUHJvZHVjdCI6IlN1YnNjcmlwdGlvbiIsIm5iZiI6MTc1NDc4NTEzMywiZXhwIjoxNzU3NDYzNTMzLCJpYXQiOjE3NTQ3ODUxMzMsImlzcyI6Imh0dHBzOi8vd3d3LnByaXN0aW5laW52b2ljZS5jb20iLCJhdWQiOiJodHRwczovL3d3dy5wcmlzdGluZWludm9pY2UuY29tIn0.t1fV5Jh_3ZkMJo8_parPphuxiwgs5PHgdPNWpZz77HsLutUFYJP1rENF17y9UoGFdZyIIPFhk6Sf-DaF3FjVUw";

        var zatcaClient = new ZatcaApiClient(apiBaseUrl, jwtToken);

        try
        {
            // Example 1: Basic invoice
            var basicInvoice = zatcaClient.CreateBasicInvoice();
            var basicResponse = await zatcaClient.ReportSimplifiedInvoice(basicInvoice);
            Console.WriteLine($"Basic invoice reported. UUID: {basicResponse.Status}\nMessage: {basicResponse.Message}");

            // Example 2: Invoice with document allowances
            var allowanceInvoice = zatcaClient.CreateInvoiceWithDocumentAllowances();
            var allowanceResponse = await zatcaClient.ReportSimplifiedInvoice(allowanceInvoice);
            Console.WriteLine($"Allowance invoice reported. QR Code: {allowanceResponse.QrCodeValue}\nMessage: {basicResponse.Message}");

            // Example 3: Mixed tax invoice
            var mixedTaxInvoice = zatcaClient.CreateMixedTaxInvoice();
            var mixedTaxResponse = await zatcaClient.ReportSimplifiedInvoice(mixedTaxInvoice);
            Console.WriteLine($"Mixed tax invoice reported. Hash: {mixedTaxResponse.Hash}\nMessage: {basicResponse.Message}");

            // Example 4: Credit note
            var creditNote = zatcaClient.CreateCreditNote();
            var creditNoteResponse = await zatcaClient.ReportSimplifiedInvoice(creditNote);
            Console.WriteLine($"Credit note reported. ICV: {creditNoteResponse.Icv}\nMessage: {basicResponse.Message}");

            // Example 5: Debit note
            var debitNote = zatcaClient.CreateDebitNote();
            var debitNoteResponse = await zatcaClient.ReportSimplifiedInvoice(debitNote);
            Console.WriteLine($"Credit note reported. ICV: {debitNoteResponse.Icv}\nMessage: {basicResponse.Message}");


            // Example 6: Invoice with line allowances
            var lineAllowanceInvoice = zatcaClient.CreateInvoiceWithLineAllowances();
            var lineAllowanceResponse = await zatcaClient.ReportSimplifiedInvoice(lineAllowanceInvoice);
            Console.WriteLine($"Line allowance invoice reported. Status: {lineAllowanceResponse.Status}\nMessage: {basicResponse.Message}");

            // Example 7: Invoice with All attributes
            // sample code to show all the attributes of the invoice


        }
        catch (Exception ex)
        {
            Console.WriteLine($"Error: {ex.Message}");
        }
    }
}
Download Simplified sample

This console application project developed in c# contains complete source code

Download Rar
}