Sales Invoice
Step 1: Authentication
If not done previously, the process of obtaining an access_token must be carried out in order to authenticate in the services mentioned in the following steps, following what is described in the authentication section.
Step 2: Validate NIT
This step is only followed when the Identity Document Type included in the invoice is NIT (identity document type code: 5). In these cases, the service to validate the NIT should be used.
Parameters:
branchCode: Branch Code.nit: Represents the NIT number to which the invoice will be issued.
Successful response (Code 200)
{
"status": "string",
"data": {
"codigo": 0,
"descripcion": "string"
}
}
Where:
codigo: Code of the NIT status.descripcion: Description of the NIT status.
Based on the response from the service, the value of the codigoExcepcion field is defined:
- Exception Code (0): Valid NIT.
- Exception Code (1): Invalid NIT.
Note: In case the NIT is Invalid, you must confirm with the end user the issuance of the invoice with an invalid NIT (sending the
codigoExcepcionwith value1).
Step 3: Invoicing
To be able to issue an invoice refer to the following link of the documentation:
POST/api/v1/sucursales/{branchCode}/facturas/compra-ventaPerforms the issuance of a Sales Invoice.URL Parameter:
branchCode: The branch code.
Request Body (Example):
{
"numeroFactura": 9999999998,
"nombreRazonSocial": "string",
"codigoPuntoVenta": 9999,
"fechaEmision": "2021-01-25T18:03:00.000Z",
"cafc": "101A6A36DA839",
"codigoExcepcion": true,
"descuentoAdicional": 0,
"montoGiftCard": 0,
"codigoTipoDocumentoIdentidad": 5,
"numeroDocumento": "string",
"complemento": "strin",
"codigoCliente": "string",
"codigoMetodoPago": 26,
"numeroTarjeta": 10000000000000000,
"montoTotal": 1,
"codigoMoneda": 154,
"montoTotalMoneda": 1,
"usuario": "string",
"emailCliente": "string",
"telefonoCliente": "string",
"extras": {
"uniqueCode": "string",
"facturaTicket": "string"
},
"codigoLeyenda": 0,
"montoTotalSujetoIva": 1,
"tipoCambio": 1,
"detalles": [
{
"codigoProducto": "string",
"codigoActividadSin": "string",
"codigoProductoSin": 99999999,
"descripcion": "string",
"unidadMedida": 69,
"precioUnitario": 1,
"subTotal": 1,
"cantidad": 1,
"numeroSerie": "string",
"montoDescuento": 0,
"numeroImei": "string"
}
]
}
Field Specifications
| Field | Type | Example | Format | Min Size | Max Size | Compulsory |
|---|---|---|---|---|---|---|
numeroFactura | Number | 1 | 1 | 9999999 | No (optional if Emizor manages it) | |
nombreRazonSocial | String | 3 | 150 | Yes | ||
codigoPuntoVenta | Number | 0 | 1 | 5 | Yes | |
fechaEmision | String | 2021-01-25T18:03:00.000Z | ISO8601 | 24 | 24 | Yes |
cafc | String | 101A6A36DA839 | 1 | 13 | No | |
codigoExcepcion | Number | 1 | - | - | No | |
descuentoAdicional | Number | 17.2 | 1 | 9 | Yes | |
montoGiftCard | Number | 0 | 17.2 | 1.0 | 9999999.99 | Yes |
codigoTipoDocumentoIdentidad | Number | 1 | 1 | 5 | Yes | |
numeroDocumento | String | 123456 | 1 | 18 | Yes | |
complemento | String | A1 | 1 | 5 | No | |
codigoCliente | String | 3 | 150 | Yes | ||
codigoMetodoPago | Number | 1 | 1 | 5 | Yes | |
numeroTarjeta | Number | 123400005678 | 8 | 16 | No | |
montoTotal | Number | 1000.36 | 17.2 | 1.0 | 9999999.99 | Yes |
codigoMoneda | Number | 154 | 1 | 5 | Yes | |
montoTotalMoneda | Number | 1000.36 | 17.2 | 1.0 | 9999999.99 | Yes |
usuario | String | Roberto Lopez | 3 | 80 | Yes | |
emailCliente | String | juanperez@example.com | x@x.x | 5 | 50 | Yes |
telefonoCliente | Number | - | 15 | No | ||
extras | JSON | { "terminos": "", "notas": "", "nombreContacto": "", "facturaTicket": "546456sd4ds54d6sa" } | {} | - | - | Yes, The facturaTicket must always be sent as the unique code. |
codigoLeyenda | Number | 1 | 1 | 5 | Yes | |
montoTotalSujetoIva | Number | 1000.36 | 17.2 | 1.0 | 9999999.99 | Yes |
tipoCambio | Number | 6.96 | 17.2 | 1.0 | 9999999.99 | Yes |
detalles | Array | [{},{},...] | 1 (products) | 500 (products) | Yes | |
codigoProducto | String | 2 | 30 | Yes | ||
codigoActividadSin | String | 1 | 10 | Yes | ||
codigoProductoSin | Number | 1000 | 1 | 999999 | Yes | |
cantidad | Number | 17.2 | 1 | 5 | Yes | |
precioUnitario | Number | 17.2 | 1 | 5 | Yes | |
descripcion | String | 3 | 500 | Yes | ||
unidadMedida | Number | 57 | 3 | 1 | 104 | No |
subTotal | Number | 100.45 | 17.2 | 1.0 | 9999999.99 | Yes |
montoDescuento | Number | 10.19 | 17.2 | NULL | 99999.99 | Yes |
numeroSerie | String | 1 | 1500 | No | ||
numeroImei | String | 1 | 1500 | No |
Description of each field:
| Field | Description |
|---|---|
numeroFactura | Represents the invoice number. Note: If you want the system to automatically manage the numbering of your invoices, do not send this field. |
nombreRazonSocial | Represents the name or business name of the client. |
codigoPuntoVenta | Represents the code of the point of sale in which the invoice is issued. |
fechaEmision | Represents the date of issuance of the invoice. |
cafc | Represents the CAFC if applicable (Offline computerized invoices). |
codigoExcepcion | Send 1 if the issuance of the invoice was confirmed for an invalid NIT. Otherwise send 0. |
descuentoAdicional | Represents the additional discount applied to the total amount. |
montoGiftCard | Represents the amount paid with a Gift Card. |
codigoTipoDocumentoIdentidad | Represents the code of the client's identity document type. Ex: 1: CI; 2: Foreign CI; 3: Passport; 4: Others; 5: NIT. |
numeroDocumento | Represents the client's document number. |
complemento | Represents the complement of the client's CI. |
codigoCliente | Represents the client code in the local system. |
codigoMetodoPago | Represents the code of the payment method. (See parameters table payment methods). |
numeroTarjeta | Represents the first 4 digits and the last 4 digits of the credit or debit card Ex: 5412000000008451. |
montoTotal | Represents the total amount of the invoice. |
codigoMoneda | Represents the code of the currency used. (See currency parameter table). |
montoTotalMoneda | Represents the total amount of the invoice in the currency used. Note: If the currency is Bolivianos (154) it is the same value as montoTotal. |
usuario | Represents the user who issues the invoice. |
emailCliente | Represents the client's email address for sending the invoice. |
telefonoCliente | Represents the client's phone number. |
extras | Represents a json object with extra information for the invoice. |
extras => facturaTicket | This parameter is mandatory as it serves to register the invoice uniquely in the EMIZOR system. |
codigoLeyenda | Represents the code of the legend that will be shown on the invoice. (See legends parameter table). |
montoTotalSujetoIva | Represents the total amount of the invoice that is subject to the payment of VAT. Note: If there is a Gift Card, the total amount subject to VAT is the total amount minus the Gift Card amount. |
tipoCambio | Represents the exchange rate used if the currency is different from Bolivianos. |
detalles | Represents a json object array with the detail of the invoice items. |
codigoProducto | Represents your own product code. |
codigoActividadSin | Represents the economic activity code associated with the product. |
codigoProductoSin | Represents the SIN product code associated with the product. |
descripcion | Represents the product description. |
unidadMedida | Represents the code of the unit of measure of the product. (See unit parameter table). |
precioUnitario | Represents the unit price of the product. |
subTotal | Represents the subtotal of the item. Calculated as: (precioUnitario * cantidad) - montoDescuento. |
cantidad | Represents the quantity sold. |
numeroSerie | Represents the serial number of the product (if applicable). |
montoDescuento | Represents the discount amount applied to the item. |
numeroImei | Represents the IMEI number of the product (if applicable). |
Possible errors (Code 400):
{
"status": "error",
"error": {
"numeroFactura": [
"The 'invoice number' attribute is required",
"invoice number must be an integer."
]
// ... other validation errors ...
}
}
Responses
| Code | Response |
|---|---|
| 200 | Successful. Returns information like cuf, ack_ticket, urlSin, xml_url, shortLink, etc. |
| 201 | Returns validation error information: {"status": false, "data": {"Field_name": ["validation_1", "validation_2"]}} |
| 401 | {"message": "Unauthenticated"} |
| 404 | The process could not be performed due to parameter inconsistency: {"status": false, "data": {"Point of Sale not found", "etc"}} |
Important fields in response 200:
- CUF: Unique Invoice Code managed by Impuestos Nacionales.
- urlSin: Represents the URL of the invoice in the SIN.
- emission_type_code: 1 for ONLINE, 2 for OFFLINE.
- numeroFactura: Invoice number.
- shortLink: Link of the invoice PDF.
- xml_url: Link of the invoice XML.
Step 4: Check Invoice Status
The service is described in section 3.2 of this document.
Step 5: Get Invoice Details
The service is described in section 3.3 of this document.