Skip to content

Query Sales

Through this entry point, SDH will perform the query of a list of up to 1,000 invoices to obtain information about the status of the invoice both in SDH and in the administration.
Keep in mind that in Veri*Factu, deferred delivery is performed, which makes it useful to query the status of the invoice delivery to the administration.

Call

The required data for this entry point is the list of invoice series and numbers.

InvoicingClient client = new InvoicingClient();

...
List<IdSalesInvoice> idSalesInvoiceList = new List<IdSalesInvoice>();
idSalesInvoiceList.Add(new IdSalesInvoice() { Series = series, Number = number });
...

Solmicro.DigitalHub.Global.Dtos.OutEngineContainer result = client.QuerySales(idSalesInvoiceList);
curl -X POST https://apitest.solmicrosdh.com/invoicing/querysales \
--cert /ruta/al/certificado.pfx \
--cert-type P12 \
--pass mypfxpassword \
-H "Content-Type: application/json" \
-H "CompanyId: guid-unico-empresa" \
-H "InstallationId: guid-unico-instalacion" \
-d '[
        {
        "series": "string",
        "number": "string"
        }
    ]'

Result

Veri*Factu

The result will be an object of type VeriFactuConsultasResult, which will contain the list VeriFactuConsultaResults with the following information:

  • Series: Invoice series.
  • Number: Invoice number.
  • SalesInvoiceId: Unique identifier of the invoice in SDH’s database.
  • DateAndTime: Invoice issue date.
  • Type: Type of invoice.
  • DestinationStateState: If the invoice has been submitted to the administration, the current status of the record for the administration.
  • DestinationStateResponse: If the invoice was submitted to the administration with an error, the error message returned by the administration.
  • DestinationStateErrorCode: If the invoice was submitted to the administration with an error, the error code returned by the administration.
  • DestinationStateDateAndTime:
  • If submitted to the administration → date of the administration’s response.
  • If not submitted → date when SDH processed the invoice.
  • Hash: Invoice fingerprint.
  • PreviousSeries: Series of the invoice used for chaining.
  • PreviousNumber: Number of the invoice used for chaining.
  • PreviousDateAndTime: Date of the invoice used for chaining.
  • UrlQR: Text with the information required to generate the QR.
  • QRBase64: Base64‑encoded text containing the QR image.
  • For the remaining fields, see the result information.
if (result.ErrorMessages.Count() > 0) 
{
    // Iterate through the list and handle the errors

    return;
}
VeriFactuConsultasResult vfResults = result.OfType<VeriFactuConsultasResult>().FirstOrDefault();
if (vfResults is not null)
{
    foreach (var vfResult in vfResults.VeriFactuConsultaResults)
    {
        vfResult.Series;
        vfResult.Number;
        vfResult.SalesInvoiceId;
        vfResult.DateAndTime;
        vfResult.Type;
        vfResult.DestinationStateState;
        vfResult.DestinationStateResponse;
        vfResult.DestinationStateErrorCode;
        vfResult.DestinationStateDateAndTime;
        vfResult.Hash;
        vfResult.PreviousSeries;
        vfResult.PreviousNumber;
        vfResult.PreviousDateAndTime;
        vfResult.UrlQR;
        vfResult.QRBase64;
        ...
    }
}
{
    "ContainerId": "string",
    "Results": [],
    "ErrorMessages": [
        {
            "Code": "string",
            "Text": "string"
        }
    ]
}

Veri*Factu

{
    "Series": "string",
    "Number": "string",
    "SalesInvoiceId": "string",
    "DateAndTime": "datetime",
    "Type": integer,
    "DestinationStateState": integer,
    "DestinationStateResponse": "string",
    "Hash": "string",
    "PreviousSeries": "string",
    "PreviousNumber": "string",
    "PreviousDateAndTime": "datetime",
    "UrlQR": "string",
    "QRBase64": "string",
    ...
}