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)
| |||||||
| 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
- POST New invoice / resubmission (zuzendu) TicketBAI / Verifactu
- POST Complete a simplified invoice
- GET Get a TicketBAI / Verifactu invoice
- GET List TicketBAI / Verifactu invoices
- GET Download TicketBAI / Verifactu XML
- GET Download invoice in FacturaE format
- GET Download invoice as PDF
- GET System status
- DEL Cancel a TicketBAI / Verifactu invoice
- PUT Force TicketBAI / Verifactu resend
- POST Validate a NIF with the AEAT
- POST Validate a VAT number in VIES
Representation document
- GET Representation document - Download template
- POST Representation document - Upload document
- GET Representation document - Download uploaded document
- DELETE Representation document - Revoke uploaded document
BATUZ BIZKAIA specific methods
- GET List IAE activity codes
- POST LROE - Received invoices - Submit (BATUZ)
- PUT LROE - Received invoices - Update (BATUZ)
- GET LROE - Received invoices - Query (BATUZ)
- DEL LROE - Received invoices - Cancel (BATUZ)
- POST LROE - Expenses without invoice - Submit (BATUZ, form 140)
- PUT LROE - Expenses without invoice - Update (BATUZ, form 140)
- GET LROE - Expenses without invoice - Query (BATUZ, form 140)
- DEL LROE - Expenses without invoice - Cancel (BATUZ, form 140)
- POST LROE - Cash accounting COLLECTIONS - Submit (BATUZ)
- PUT LROE - Cash accounting COLLECTIONS - Update (BATUZ)
- GET LROE - Cash accounting COLLECTIONS - Query (BATUZ)
- DEL LROE - Cash accounting COLLECTIONS - Cancel (BATUZ)
- POST LROE - Cash accounting PAYMENTS - Submit (BATUZ)
- PUT LROE - Cash accounting PAYMENTS - Update (BATUZ)
- GET LROE - Cash accounting PAYMENTS - Query (BATUZ)
- DEL LROE - Cash accounting PAYMENTS - Cancel (BATUZ)
SII (AEAT)
Customers and products (invoicing tool)
- GET Customers - Search / get customers
- POST Customers - New customer
- PUT Customers - Update customer
- GET Products - Search / get products
