Generate Standard E-Invoice (B2B)

Create a valid Standard E-Invoice with a JSON payload and report it to ZATCA in real-time.

For detailed specifications of the data models used in the request.

🚧

This endpoint is specifically used for Standard e-invoices only (B2B) invoices,

This endpoint is specifically used for standard E-invoices (B2B) only. According to ZATCA regulations, all standard e-invoices must be reported to ZATCA immediately.


Request Example

{
    "deviceId": "{DeviceId:UUID}",
    "eInvoiceDTO": {
        "invoiceNumber": "PSI25-00020",
        "uuid": "3444073b-e697-4811-a5fa-f83e7f248af8",
        "invoiceTypeCode": "0100000",
        "invoiceTypeValue": "388",
        "issuedDateTime": "2024-06-23T17:58:26.115Z",
        "documentCurrencyCode": "SAR",
        "taxCurrencyCode": "SAR",
        "actualDeliveryDate": "2024-06-23T17:58:26.116Z",
        "latestDeliveryDate": "2024-06-23T17:58:26.116Z",
        "supplierInfo": {
            "vat": "3***********3",
            "registrationName": "{CompanyName}",
            "crn": "3***********3",
            "partyPostalAddress": {
                "streetName": "Riyadh",
                "buildingNumber": "8022",
                "plotIdentification": "",
                "citySubdivisionName": "الرياض",
                "cityName": "الرياض",
                "postalZone": "11543",
                "countrySubentity": "SA",
                "country": "SA"
            }
        },
        "customerInfo": {
            "vat": "*************",
            "registrationName": "نقداً",
            "nat": "123455678",
            "partyPostalAddress": {
                "streetName": "",
                "buildingNumber": "",
                "plotIdentification": "",
                "citySubdivisionName": "Riyadh",
                "cityName": "Riyadh",
                "postalZone": "",
                "countrySubentity": "SA",
                "country": "SA"
            }
        },
        "paymentMeans": [
            {
                "code": 10
            }
        ],
        "taxTotals": [
            {
                "taxAmount": {
                    "currencyCode": "SAR",
                    "amount": 2.94
                },
                "roundingAmount": {
                    "currencyCode": "SAR",
                    "amount": 22.50
                }
            },
            {
                "taxAmount": {
                    "currencyCode": "SAR",
                    "amount": 2.94
                },
                "roundingAmount": {
                    "currencyCode": "SAR",
                    "amount": 22.50
                },
                "taxSubtotals": [
                    {
                        "taxAmount": {
                            "currencyCode": "SAR",
                            "amount": 2.94
                        },
                        "taxableAmount": {
                            "currencyCode": "SAR",
                            "amount": 19.56
                        },
                        "taxCategory": {
                            "id": 0,
                            "percent": 15,
                            "taxSchemeId": "VAT"
                        }
                    }
                ]
            }
        ],
        "legalMonetaryTotal": {
            "lineExtensionAmount": {
                "currencyCode": "SAR",
                "amount": 19.56
            },
            "taxExclusiveAmount": {
                "currencyCode": "SAR",
                "amount": 19.56
            },
            "taxInclusiveAmount": {
                "currencyCode": "SAR",
                "amount": 22.50
            },
            "allowanceTotalAmount": {
                "currencyCode": "SAR",
                "amount": 0.00
            },
            "prepaidAmount": {
                "currencyCode": "SAR",
                "amount": 0.00
            },
            "payableAmount": {
                "currencyCode": "SAR",
                "amount": 22.50
            }
        },
        "invoiceLines": [
            {
                "id": "10000",
                "itemName": {
                    "en": "Item 1",
                    "ar": "عنصر 1"
                },
                "invoicedQuantity": 1,
                "lineExtensionAmount": {
                    "currencyCode": "SAR",
                    "amount": 6.52
                },
                "taxAmount": {
                    "currencyCode": "SAR",
                    "amount": 0.98
                },
                "roundingAmount": {
                    "currencyCode": "SAR",
                    "amount": 7.50
                },
                "taxCategory": {
                    "percent": 15,
                    "id": 0,
                    "taxSchemeId": "VAT"
                },
                "priceAmount": {
                    "currencyCode": "SAR",
                    "amount": 6.52174
                },
                "allowanceCharge": {
                    "chargeIndicator": false,
                    "allowanceChargeReason": "discount",
                    "amount": {
                        "currencyCode": "SAR",
                        "amount": 7.50
                    }
                }
            },
            {
                "id": "20000",
                "itemName": {
                    "en": "Item 2",
                    "ar": "عنصر 2"
                },
                "invoicedQuantity": 1,
                "lineExtensionAmount": {
                    "currencyCode": "SAR",
                    "amount": 13.04
                },
                "taxAmount": {
                    "currencyCode": "SAR",
                    "amount": 1.96
                },
                "roundingAmount": {
                    "currencyCode": "SAR",
                    "amount": 15.00
                },
                "taxCategory": {
                    "percent": 15,
                    "id": 0,
                    "taxSchemeId": "VAT"
                },
                "priceAmount": {
                    "currencyCode": "SAR",
                    "amount": 13.04348
                }
            }
        ]
    }
}

Response Example

{
  "status": "completed",
  "warningMessages": [],
  "errorMessages": [],
  "qrCode": "{qrCode}",
  "signedInvoice": "",
  "invoiceHash": "",
  "invoiceCounter": 2
}

Response Params

****
ParameterData TypeDescription
statusstringstatus of the invoice reporting process. either "failed" or "completed"
warningMessageslist of warningMessagewhen the invoice receives an "Accepted with Warnings" status from ZATCA, a list of warnings will be provided detailing the issues identified
errorMessageslist of errorMessage.when the invoice status "failed" you will get list of errorMessages.
qrCodestring.base64 string encoded.
signedInvoicestring.signed XML invoice submitted to ZATCA (XML encoded string).
invoiceHashstring.unique hash that indicates the specific sequence of that invoice within the device's transaction log
invoiceCounterinteger.the place/index of the invoice in the device queue

warningMessage and ErrorMessage Object

ParameterData TypeDescription
typestringThe type of issue encountered
codestringA code identifying the specific issue
categorystringThe general category of the issue
messagestringA brief explanation of the issue
statusstringThe current status of the issue

Response Status Code

HTTP Status CodeDescription
200invoice is reported successfully
400invalid combination of Invoice Type Code and Invoice Type Value was detected, or a validation error occurred. - detailed in the errorMessages list
Language
Credentials
Header
Click Try It! to start a request and see the response here!