API > LROE - Modify received invoices

LROE - Modify received invoices

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

IMPORTANT: This method is only valid for BATUZ Bizkaia. Lets you modify received invoices (purchases) previously sent 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
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.
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
Invoice type: inversion or gasto
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
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
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
num_factura_rectificada string required if corrective
Number of the invoice being corrected
2023000100
fecha_rectificada string required
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


PUT https://{entorno}.ticketbaiws.eus/lroe-recibidas/
$ curl --request PUT \
     --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()->modificar([
    '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("PUT", url, json=payload, headers=headers)

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

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
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_PUTFIELDS, '{"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/")
  .put(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