Inicio  |  Autofactura  |  Webservice Autofactura  |  Autofactura.importar.EnglishVersion
La LCO fue actualizada por última vez el 23/nov/2024

Autofactura.importar

Receives a list of tickets, with their details, and validates each one.
Returns a list with the status of the attempt to import each ticket.

Parameters:

This method receives 3 parameters, 2 of them being located in the header of the SOAP request.

Name Description Required
clientId

xs:string

Username registered for this WebService.

Yes
password

xs:string

User's password

Yes
file

xs:base64Binary

Byte array of the Document to be imported, in base64 encoding. The file must be in plain text.
The file must be of type Autofactura connector string in plain text.

Yes

Request example

Download this example.

Returns

The method returns a complex type: Importacion. It's attributes are described below:

Importacion's attributes
Name Description Required
status

xs:int

Operation status' code. Response codes

Yes
mensaje

xs:string

The response message: a string detailing the operation's status.

Yes
idTransaccion

xs:string

Identifier of the transaction in which the ticket was processed. It may be absent if the ticket could not be processed.

No
resultados

Array of type tns:resultadoImportacion

Details of the result of every ticket imported.

No

tns:resultadoImportacion

Name Description Required
status

xs:int

Ticket's status

Yes
mensaje

xs:string

Ticket's Message

No
noTicket

xs:string

Ticket's number

No

Response Example - importar (import)

Download this example

Connector string

The connector string is the representation of each element in the importation file used by the importar (import) method of the WebService.

NameTypeRequiredDescriptionExample
TICKET_NOStringRTicket identifier, it can be a composite.02OTR0010558223088D
FECHA_HORAStringRDate and time. It's format can be specified by the client.08/13/2012T11:43:18
SUBTOTAL_FACTURABigDecimalRTicket's subtotal amount, with a maximum of 6 digits.449.5441
TOTAL_FACTURABigDecimalRTicket's total amount, with a maximum of 6 digits.535.1716
NOTASStringOAdditional notes."No notes"
MONEDA_NOMBREStringOCurrency's name.Mexican Peso
MONEDA_SIMBOLOStringOCurrency's Symbol, if ommited, 'MXN' is used.USD
TIPO_CAMBIOBigDecimalOCurrency's exchange rate to Mexican Pesos at the moment of using this method.1.00
FORMA_PAGOStringOSystem's code for the form of payment (cash, credit card, etc). It can be predefined at the moment of configuring the client's account.03, 02, 99
METODO_PAGOStringOSystem's code for the method of payment (PUE: Single payment, PPD: several payments).PUE, PPD
VALOR_UNITARIOBigDecimalOUnit price, if omitted the value SUBTOTAL_FACTURA will be used.160.45
CLAVE_UNIDADStringRUnit of measurement's code of item, as taken from the SAT catalogues. The code must coincide with the product's description. (GLI=Gallon, etc)GLI
UNIDADStringOUnit of measurement of item, as defined by the client.Pounds
CLAVE_PROD_SERV_SATStringRProduct or Service's code, as taken from the SAT catalogues. (10101506=Horses, 70131506=Soil improvement, etc).78111900
CODIGOStringOItem codea-113
CONCEPTOStringOProduct or service description."Gift package number 4"
CANTIDADBigDecimalOProduct or Service's quantity, if omitted the value 1.000000 will be used.1.00
IMPORTEBigDecimalOProduct or Service amount, if omitted the value SUBTOTAL_FACTURA will be used.140.45
IMPORTE_DESCUENTOBigDecimalOProduct or service discount amount. Must be equal or less than IMPORTE and negative values are not allowed.34.00
TASA_IVA_LINEABigDecimalOProduct or service IVA tax (VAT) rate. Must be in percentage.16.00
BASE_IVABigDecimalOBase amount for the IVA tax (VAT) calculation. Negative values are not allowed.140.45
MONTO_IVABigDecimalOProduct or service IVA tax amount (VAT amount).22.472
TASA_IEPS_LINEABigDecimalOProduct or service's IEPS tax rate. Must be in percentage and negative values are not allowed. If this value is specified, CUOTA_IEPS must be left in blank.3.00
CUOTA_IEPSBigDecimalOProduct or service's IEPS tax quota. If this value is specified, TASA_IEPS_LINEA must be left in blank.
BASE_IEPSBigDecimalOBase amount for the IEPS tax calculation. Negative values are not allowed.140.45
MONTO_IEPSBigDecimalOProduct or service IEPS tax amount.4.2135
TASA_RET_IVABigDecimalOIVA tax withholdings rate, must be in percentage10.667.
BASE_RET_IVABigDecimalOBase amount for the IVA tax withholdings, negative values are not allowed.140.45
MONTO_RET_IVABigDecimalOIVA tax withholdings amount.14.9818015
RE_IMPORTARBooleanOIf True a previous generated ticket may be re-imported, if False it will not be re-imported.true, false
USO_CFDIStringR Code of usage of the invoice-to-be-created out of this ticket, as taken from the SAT catalogues. (G03=General expenses, D04=Donations, etc)P01

O = Optional
C = Conditional
R = Required

The connector string must have the following order:

TICKET_NO|FECHA_HORA|SUBTOTAL_FACTURA|TOTAL_FACTURA|NOTAS|MONEDA_NOMBRE|MONEDA_SIMBOLO|TIPO_CAMBIO|FORMA_PAGO|METODO_PAGO|VALOR_UNITARIO|CLAVE_UNIDAD|UNIDAD|CLAVE_PROD_SERV_SAT|CODIGO|CONCEPTO|CANTIDAD|IMPORTE|IMPORTE_DESCUENTO|TASA_IVA|BASE_IVA|MONTO_IVA|TASA_IEPS|CUOTA_IEPS|BASE_IEPS|MONTO_IEPS|TASA_RET_IVA|BASE_RET_IVA|MONTO_RET_IVA|RE_IMPORTAR|USO_CFDI|
Example of a connector string for autofactura

|02OTR0010558223088D|01/01/2018T00:00:01|100|116|Notes|MexicanPesos|MXN|1|99|PUE|100|EA|PZA|1010101|10001023|itemNo.214a|1|100|0|16|100|16|||||||||P01|

Verifier digit

Generation

The Verifier digit is formed by the first 2 digits of the string generated by applying a hash SHA-1 to the ticket number.

Let's take for example the following ticket number: 02OTR0010558223088D

02 The ticket issuer's ID (alphanumeric).
OTR The local branch/subsidiary's ID from where the ticket will be issued (alphanumeric).
00105582 Ticket number.

The last 6 character long segment 23088d is composed by:

2 = Number of characters of the issuer's ID, in this case: 02.
3 = Number of characters of the local branch/subsidiary's ID, in this case: OTR.
08 = Number of characters of the ticket number, 2 digits are mandatory, in this case: 00105582.
8d = first 2 digits of the SHA-1 result of 02OTR001055822308

In other words:

Issuer Local branch/subsidiary Ticket Issuer no. of characters Local branch/subsidiary no. of characters Ticket no. of characters Verifier digit
02 OTR 00105582 2 3 08 8D
Alphanumeric Alphanumeric Alphanumeric 1 to 9 1 to 9 1 to 99
2 digits mandatory
Alphanumeric
2 digits mandatory

The hash is generated with the first 6 elements of the ticket:

02 OTR 00105582 2 3 08

Hashing 02OTR001055822308 with SHA-1 results in::

8D811497A8A289C1351646AA73161AC0967AAC78

Hash's first 2 digits:

8D 811497A8A289C1351646AA73161AC0967AAC78

TICKET_NO with the verifier digit:

02OTR001055822308 8D

Response Codes

200 — Successful access: The client authenticated correctly and the method returned the results
In other words: any process which terminated without errors.
201 — Successful access: The client authenticated correctly and the method returned the results
In other words: any process which terminated without errors.
202 — This ticket had already been processed in a past import-transaction, this ticket already exists in a past transaction.
204 — There are errors regarding the validation of the ticket's verifier digit.
The verifier digit validation failed, this happened because either the ticket number does not comply with the verifier digit specifications or the generated SHA-1 hash is different.
206 — An invoice has already been created with this ticket.
208 — The ticket could not be stored and marked as an invoice.
The storage process found a problem and hence could not continue.
500 — Error found attempting to process the tickets.
Error found attempting to read the tickets' data.
601 — Client's authentication error.
Username / password incorrect.
Datos de contacto
comments powered by Disqus