API > LROE - Send received invoices

LROE - Send received invoices

POST  https://{entorno}.ticketbaiws.eus/lroe-recibidas/

IMPORTANT: This method is only valid for BATUZ Bizkaia. Lets you send received invoices (purchases) to the Batuz LROE

PARAMETERS

ejercicio integer required
Fiscal year of the batch of received invoices, in yyyy format
2023
facturas object array required (max 1000) records
fecha string required
Invoice issue date in dd/mm/yyyy format
13/11/2023
fecha_operacion string optional
Date on which the transaction took place, if different from the issue date, in dd/mm/yyyy format
13/11/2023
fecha_recepcion string optional
Date the invoice was received, in dd/mm/yyyy format
13/11/2023
nif string required
NIF (Spanish tax ID) of the invoice issuer
B01000012
tipo_documento string optional
Type of identification document for foreign suppliers. Defaults to 02.
Possible values:
02 => VAT ID (NIF-IVA)
03 => Passport
04 => Official identity document issued by the country or territory of residence,
05 => Certificate of residence
06 => Other supporting document
02
pais string optional
Two-letter country code of the invoice issuer if the supplier's tax ID is foreign (ISO-3166 Alpha-2 code format)
ES
nombre_social string required
Company name of the supplier issuing the invoice
Empresa de ejemplo S.L.
serie string optional
Invoice series
A
num_factura string required
Invoice number
2023715273
descripcion string required
Description of the transaction (sent to Batuz as DescripcionOperacion). Maximum 250 characters.
Factura móviles
descripción string required
Description of the service and/or product on the invoice
Factura móviles
importacion boolean required
Whether it is an import invoice
false

tipo_factura enum required
Possible values:
compras (Purchase of current goods)
inversion (Acquisition of capital goods)
gasto (Expenses)

gasto
importe_total float required
Invoice total amount, VAT included
121.00
bases object array.  required
Tax bases of the invoice
base_imponible float required
Tax base amount EXCLUDING VAT
100.00
tipo_iva float required
VAT percentage applied to the tax base
21.00
tipo_req float required
Equivalence surcharge percentage applied to the line
0.00
tipo enum optional (to specify a value different from the invoice-level one)
Possible values:
compras (Purchase of current goods)
inversion (Acquisition of capital goods)
gasto (Expenses)
inversion
cuota_soportada float optional
If not set, the input VAT amount is calculated automatically. If you
specify the input VAT amount, you must also specify the
deductible amount
21.00
cuota_deducible float optional
If set, the prorrata parameter has no effect. Required if you want to
specify the input VAT amount
10.50
epigrafe integer optional, only for individuals (natural persons) in Bizkaia (LROE 140)
Indicates that the item belongs to a specific IAE activity code, different from the general one defined in the company profile or from the one defined on the invoice.
197210
bien_afecto_irpf_iva integer optional, only for individuals (natural persons) in Bizkaia (LROE 140)
Identifier specifying whether this is the acquisition of a business asset for IRPF (personal income tax) purposes or a VAT capital good. If this field is not provided, it defaults to «N». Possible values: I, R, or N
N
importe_gasto_irpf integer optional, only for individuals (natural persons) in Bizkaia (LROE 140)
Amount of the expense deductible for IRPF (personal income tax)
121.00
concepto_contable integer optional, only for individuals (natural persons) in Bizkaia (LROE 140)
Code identifying the accounting subgroup or account
600
referencia_bien integer optional, only for individuals (natural persons) in Bizkaia (LROE 140)
Reference of the business asset to which the expense in the accounting account may relate; it must match the reference shown in the business assets or capital goods section
ABC
modo_recargo_simplificado integer optional, only for individuals (natural persons) in Bizkaia (LROE 140)
Identifier specifying whether the invoice was received by a taxpayer under the simplified scheme or the equivalence surcharge scheme. If this field is not provided, it defaults to «N». Possible options: E (Equivalence surcharge), N (General scheme), S (Simplified scheme)
E
regimen_iva integer optional
VAT special scheme code
17
regimen_iva_2 integer optional
VAT special scheme code 2
17
regimen_iva_3 integer optional
VAT special scheme code 3
17
inversion_sujeto_pasivo boolean optional
Invoice subject to reverse charge
false
rectificativa boolean required
Whether it is a corrective invoice
false
serie_factura_rectificada string optional
Series of the invoice being corrected
A
num_factura_rectificada string required if corrective
Number of the invoice being corrected
2023000100
fecha_rectificada string required if corrective
Date of the invoice being corrected, in dd/mm/yyyy format
13/11/2023
clave_rectificativa string optional
Corrective invoice code (R1, R2, R3, R4, R5). If not set, R1 is used, or R5 for a simplified invoice
R1
tipo_rectificativa string optional
Corrective invoice type: (S) substitution  (I) by differences. If not set, it is treated as I (by differences)
I
base_rectificada float required if corrective
Tax base of the invoice being corrected
100.00
cuota_rectificada float required if corrective
VAT amount of the invoice being corrected.
21.00
prorrata integer optional
Deductible percentage of the invoice amount
92
clave_factura string optional
Invoice type code. Defaults to F1.
Possible values:
F1 - Invoice identifying the recipient
F2 - Invoice without identifying the recipient
F3 - Invoice issued to replace previously declared simplified invoices
F4 - Invoice summary entry
F5 - Imports with DUA (customs import declaration)
F6 - Other supporting documents
LC - Customs - Supplementary assessment
F1


POST https://{entorno}.ticketbaiws.eus/lroe-recibidas/
$ curl --request POST \
     --url https://api-test.ticketbaiws.eus/lroe-recibidas/ \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     --header 'Token: xxx' \
     --header 'Nif: 00000014Z'
	 --data '
{
    "ejercicio": 2023,
    "facturas":[
        {
            "fecha": "02/09/2023",
            "nombre_social": "Empresa de ejemplo S.L.",
            "nif": "B01000012",
            "num_factura": "2023715273",
            "descripcion": "Factura móviles",
            "importacion": false,
            "tipo_factura": "gasto",
            "importe_total":121.00,
            "bases": [
                {
                    "base_imponible": 100.00,
                    "tipo_iva": 21.00,
					"tipo_req": 0,
					"epigrafe": "197210"
                }
            ],
			"regimen_iva": 1,
			"inversion_sujeto_pasivo": false,
			"rectificativa": true,
			"num_factura_rectificada": "2023015273",
			"fecha_rectificada": "13/11/2023",
			"clave_rectificativa": "R1",
			"tipo_rectificativa": "S",
			"base_rectificada": 80.00,
			"cuota_rectificada" : 16.80
        }
    ]
}'
$ composer require ticketbaiws/ticketbaiws-php
<?php
// Installation: composer require ticketbaiws/ticketbaiws-php
require 'vendor/autoload.php';

$tbai = new \TicketbaiWS\Client('xxx', '00000014Z', ['entorno' => 'test']);

$r = $tbai->lroeRecibidas()->alta([
    'ejercicio' => 2023,
    'facturas'  => [
        [
            'fecha'                   => '02/09/2023',
            'nombre_social'           => 'Empresa de ejemplo S.L.',
            'nif'                     => 'B01000012',
            'num_factura'             => '2023715273',
            'descripcion'             => 'Factura móviles',
            'importacion'             => false,
            'tipo_factura'            => 'gasto',
            'importe_total'           => 121.0,
            'bases'                   => [
                ['base_imponible' => 100.0, 'tipo_iva' => 21.0, 'tipo_req' => 0, 'epigrafe' => '197210'],
            ],
            'regimen_iva'             => 1,
            'inversion_sujeto_pasivo' => false,
            'rectificativa'           => true,
            'num_factura_rectificada' => '2023015273',
            'fecha_rectificada'       => '13/11/2023',
            'clave_rectificativa'     => 'R1',
            'tipo_rectificativa'      => 'S',
            'base_rectificada'        => 80.0,
            'cuota_rectificada'       => 16.8,
        ],
    ],
]);

if ($r->isError()) {
    echo $r->getMessageText();
} else {
    print_r($r->getData());
}
$ python -m pip install requests
import requests

url = "https://api-test.ticketbaiws.eus/lroe-recibidas/"
payload = {
    "ejercicio": 2023,
    "facturas":[
        {
            "fecha": "02/09/2023",
            "nombre_social": "Empresa de ejemplo S.L.",
            "nif": "B01000012",
            "num_factura": "2023715273",
            "descripcion": "Factura móviles",
            "importacion": false,
            "tipo_factura": "gasto",
            "importe_total":121.00,
            "bases": [
                {
                    "base_imponible": 100.00,
                    "tipo_iva": 21.00,
					"tipo_req": 0,
					"epigrafe": "197210"
                }
            ],
			"regimen_iva": 1,
			"inversion_sujeto_pasivo": false,
			"rectificativa": true,
			"num_factura_rectificada": "2023015273",
			"fecha_rectificada": "13/11/2023",
			"clave_rectificativa": "R1",
			"tipo_rectificativa": "S",
			"base_rectificada": 80.00,
			"cuota_rectificada" : 16.80
        }
    ]
}

headers = {"Accept": "application/json", "Token" : "xxx", "Nif" : "00000014Z"}
response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)
CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "https://api-test.ticketbaiws.eus/lroe-recibidas/");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Accept: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, '{"ejercicio": 2023,"facturas":[{"fecha": "02/09/2023","nombre_social": "Empresa de ejemplo S.L.","nif": "B01000012","num_factura": "2023715273","descripcion": "Factura móviles","importacion": false,"tipo_factura": "gasto","importe_total":121.00,"bases": [{"base_imponible": 100.00,"tipo_iva": 21.00,"tipo_req": 0,"epigrafe": "197210"}],"regimen_iva": 1,"inversion_sujeto_pasivo": false,"rectificativa": true,"num_factura_rectificada": "2023015273","fecha_rectificada": "13/11/2023","clave_rectificativa": "R1","tipo_rectificativa": "S","base_rectificada": 80.00,"cuota_rectificada" : 16.80}]}');

CURLcode ret = curl_easy_perform(hnd);
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, '{"ejercicio": 2023,"facturas":[{"fecha": "02/09/2023","nombre_social": "Empresa de ejemplo S.L.","nif": "B01000012","num_factura": "2023715273","descripcion": "Factura móviles","importacion": false,"tipo_factura": "gasto","importe_total":121.00,"bases": [{"base_imponible": 100.00,"tipo_iva": 21.00,"tipo_req": 0,"epigrafe": "197210"}],"regimen_iva": 1,"inversion_sujeto_pasivo": false,"rectificativa": true,"num_factura_rectificada": "2023015273","fecha_rectificada": "13/11/2023","clave_rectificativa": "R1","tipo_rectificativa": "S","base_rectificada": 80.00,"cuota_rectificada" : 16.80}]}');

Request request = new Request.Builder()
  .url("https://api-test.ticketbaiws.eus/lroe-recibidas/")
  .post(body)
  .addHeader("Accept", "application/json")
  .addHeader("Token", "xxx")
  .addHeader("Nif", "00000014Z")
  .build();
  
Response response = client.newCall(request).execute();
{ } Response JSON
HTTP/1.1 200 OK
{
    "result": "OK",
    "return": {
        "response": [
            {
                "fecha": "01-09-2023",
                "num_factura": "9092",
                "estado": "Incorrecto",
                "codigo_error": "B4_2000000",
                "descripcion_error": "El campo es obligatorio por lo que debe venir informado: [DescripcionOperacion].",
                "nif": "A88888888" 
            },
            {
                "fecha": "01-09-2023",
                "num_factura": "9091",
                "estado": "Correcto",
                "nif": "A88888888"
            }
        ],
        "status": "ERROR"
    },
    "msg": null
}

TicketBAI / Verifactu methods

Representation document

BATUZ BIZKAIA specific methods

SII (AEAT)

Customers and products (invoicing tool)

Other methods