API > Complete simplified invoice

TicketBAI - Complete simplified invoice

POST  https://{entorno}.ticketbaiws.eus/tbai-completar/

This method converts one or more simplified invoices into a full invoice. The full invoice must have its own number. It is not a corrective invoice, although it is handled as if it were a replacement invoice

PARAMETERS

fecha string required
Date of the full invoice, in dd/mm/yyyy format
13/11/2021
hora string required
Issue time of the full invoice, in HH:MM:SS format
12:14:00
nif string required
NIF (Spanish tax ID) of the customer the invoice is issued to
B01000012
pais_cliente string optional
Two-letter country code of the customer if the customer's tax ID is foreign (ISO-3166 Alpha-2 code)
ES
nombre string required
Legal name of the customer the invoice is issued to
Empresa de ejemplo S.L.
direccion string required
Billing address of the customer the invoice is issued to
Calle de ejemplo 123
cp string required
Postal code of the customer the invoice is issued to
01001
serie string required
Series of the full invoice
A
numero string required
Number of the full invoice
2021000123
simplificadas object array required (max. 100)
serie string required
Series of the simplified invoice
A
numero string required
Number of the simplified invoice
2021000100
fecha string required
Issue date of the simplified invoice, in dd/mm/yyyy format
13/11/2021
intracomunitaria boolean optional
The invoice is an intra-community (EU) invoice
false
exportacion boolean optional
The invoice is an export outside the EU
false

POST https://{entorno}.ticketbaiws.eus/tbai-completar/
$ curl --request POST \
     --url https://api-test.ticketbaiws.eus/tbai-completar/ \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     --header 'Token: xxx' \
     --header 'Nif: 00000014Z'
	 --data '
{
    "fecha": "13\/11\/2021",
    "hora": "12:14:00",
    "pais_cliente": "ES",
	"nif": "B00000011",
    "nombre": "Empresa de ejemplo S.L.",
    "direccion": "Calle Falsa 123",
    "cp": "28080",
    "serie": "A",
    "numero": "2021000123",
    "simplificadas" : [
        {
            "serie": "A",
            "numero": "20210000075",
            "fecha": "10\/11\/2021"
        },
        {
            "serie": "A",
            "numero": "20210000076",
            "fecha": "10\/11\/2021"
        }
    ],
    "intracomunitaria": false,
	"exportacion": false
}'
$ 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->completarFactura([
    'fecha'            => '13/11/2021',
    'hora'             => '12:14:00',
    'nif'              => 'B00000011',
    'nombre'           => 'Empresa de ejemplo S.L.',
    'direccion'        => 'Calle Falsa 123',
    'cp'               => '28080',
    'serie'            => 'A-',
    'numero'           => '2021000123',
    'intracomunitaria' => false,
    'simplificadas'    => [
        ['serie' => 'A', 'numero' => '20210000075', 'fecha' => '10/11/2021'],
    ],
]);

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

url = "https://api-test.ticketbaiws.eus/tbai-completar/"
payload = {
    "fecha": "13\/11\/2021",
    "hora": "12:14:00",
    "pais_cliente": "ES",
	"nif": "B00000011",
    "nombre": "Empresa de ejemplo S.L.",
    "direccion": "Calle Falsa 123",
    "cp": "28080",
    "serie": "A",
    "numero": "2021000123",
    "simplificadas" : [
        {
            "serie": "A",
            "numero": "20210000075",
            "fecha": "10\/11\/2021"
        }
    ],
    "intracomunitaria": false,
	"exportacion": false
}

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/tbai-completar/");

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, '{"fecha":"13\/11\/2021","hora":"12:14:00","nif":"B00000011","nombre":"Empresa de ejemplo S.L.","direccion":"Calle Falsa 123","cp":"28080","serie":"A-","numero":"2021000123","intracomunitaria":false,"simplificadas":[{"serie":"A","numero": "20210000075","fecha": "10\/11\/2021"}]}');

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

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, '{"fecha":"13\/11\/2021","hora":"12:14:00","nif":"B00000011","nombre":"Empresa de ejemplo S.L.","direccion":"Calle Falsa 123","cp":"28080","serie":"A-","numero":"2021000123","intracomunitaria":false,"simplificadas":[{"serie":"A","numero": "20210000075","fecha": "10\/11\/2021"}]}');

Request request = new Request.Builder()
  .url("https://api-test.ticketbaiws.eus/tbai-completar/")
  .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": {
		"huella_tbai" : "TBAI-B01000012-131121-zG3wtCW3WlOSN-108",
		"qr" : "iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAIAAABEtEjdAAAABmJ...",
		"url" : "https://batuz.eus/QRTBAI/?id=TBAI-..."
	}, 
	"msg": null 
}

TicketBAI / Verifactu methods

Representation document

BATUZ BIZKAIA specific methods

SII (AEAT)

Customers and products (invoicing tool)

Other methods