Skip to content

New Sales

Through this entry point, SDH will receive the creation of a new invoice and will convert it to all required destination regulations.
It includes the following steps:

  • The corresponding validation rules.
  • The invoice chaining and the generation of the QR code to be printed on the invoice.
  • For TicketBAI: sending the invoice to the administration and processing the response.
    For Veri*Factu: deferred delivery.

Call

Depending on the destination regulation of the invoice, different fields of the SalesInvoice class must be completed.
Each regulation specifies the required fields for a correct format conversion.

InvoicingClient client = new InvoicingClient();

...

SalesInvoice si = new()
{
    Number = "", 
    Series = "", 
    DateAndTime = DateTime.Parse(""), 
    ...
};
Solmicro.DigitalHub.Global.Interfaces.List<IResult> results = client.NewSales(si);
curl -X POST https://apitest.solmicrosdh.com/v2.0/Invoicing/NewSales \
--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",
    "dateAndTime": "datetime",
    ...
}'

Result

*VeriFactu

For this regulation, the invoice remains pending delivery to the administration service, and SDH will deliver it later.
The response is a result list (List<IResult>) with a VeriFactuResult item containing the following information:

  • SalesInvoiceId: Unique identifier of the invoice in the SDH database.
  • UrlQR: Text containing the information required to generate the QR code.
  • QRBase64: Base64-encoded text that contains the QR image.
  • Hash: Invoice fingerprint.
  • DateAndTime: Invoice issue date.
  • PreviousSeries: Series of the invoice used for chaining.
  • PreviousNumber: Number of the invoice used for chaining.
  • PreviousDateAndTime: Date of the invoice used for chaining.
  • DestinationStateDateAndTime: Date when it was processed in SDH.
  • For the rest of the fields, see the response services.
VeriFactuResult result = results.OfType<VeriFactuResult>().FirstOrDefault();
if (result is not null)
{
    result.SalesInvoiceId
    result.UrlQR
    result.QRBase64
    result.Hash
    result.DateAndTime
    result.PreviousSeries
    result.PreviousNumber
    result.PreviousDateAndTime
    result.DestinationStateDateAndTime
    ...
}
[
    {
        "SalesInvoiceId": "string",
        "UrlQR": "string",
        "QRBase64": "string",
        "Hash": "string",
        "DateAndTime": "datetime",
        "PreviousSeries": "string",
        "PreviousNumber": "string",
        "PreviousDateAndTime": "datetime",
        "DestinationStateDateAndTime": "datetime",
        ...
    }
]

TicketBAI

For this regulation, the invoice is delivered directly to the administration service.
The response is a result list (List<IResult>) with a TicketBAIResult item containing the following information:

  • SalesInvoiceId: Unique identifier of the invoice in the SDH database.
  • IdTicketBAI: Text with the information needed to print next to the QR code.
  • UrlQR: Text containing the information required to generate the QR code.
  • QRBase64: Base64-encoded text that contains the QR image.
  • SignatureValue: Invoice fingerprint for the chaining.
  • SignableContent: Invoice in XML format sent to the administration.
  • For the rest of the fields, see the response administration services.
TicketBAIResult result = results.OfType<TicketBAIResult>().FirstOrDefault();
if (result is not null)
{
    result.SalesInvoiceId
    result.IdTicketBAI
    result.UrlQR
    result.QRBase64
    result.SignatureValue
    result.SignableContent
    ...
}
[
    {
        "SalesInvoiceId": "string",
        "IdTicketBAI": "string",
        "UrlQR": "string",
        "QRBase64": "string",
        "SignatureValue": "string",
        "SignableContent": "string",
        ...
    }
]