API > Consulta factura TicketBAI

Consulta factura TicketBAI

GET  https://{entorno}.ticketbaiws.eus/tbai/

Este método permite consultar la huella TBAI, el código QR y la URL de validación de una factura TicketBAI previamente generada. Dentro del cuerpo del return se devuelve el status actual de la factura, los posibles valores son OK, PENDING ó ERROR.

Los métodos GET permiten el envío de los parámetros en el body como payload JSON o mediante query string en la URL como se ve en el ejemplo cURL.

PARÁMETROS

serie string obligatorio
Serie de la factura
A
numero string obligatorio
Número de factura
2021000123

GET https://{entorno}.ticketbaiws.eus/tbai/
$ curl --request GET \
     --url https://api-test.ticketbaiws.eus/tbai/ \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     --header 'Token: xxx' \
     --header 'Nif: 00000014Z'
	 --data '{"serie":"A","numero":"2021000123"}'
$ composer require ticketbaiws/ticketbaiws-php
<?php
// Instalación: composer require ticketbaiws/ticketbaiws-php
require 'vendor/autoload.php';

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

$r = $tbai->consultarFactura('A', '2021000123');

if ($r->isError()) {
    echo $r->getMessageText();
} else {
    echo $r->getData('status');   // OK, PENDING o ERROR
}
$ python -m pip install requests
import requests

url = "https://api-test.ticketbaiws.eus/tbai/?serie=A&numero=2021000123"
headers = {"Accept": "application/json", "Token" : "xxx", "Nif" : "00000014Z"}
response = requests.request("GET", url, headers=headers)
print(response.text)
CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "https://api-test.ticketbaiws.eus/tbai/?serie=A&numero=2021000123");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Accept: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

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

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

Métodos TicketBAI / Verifactu

Documento representación

Métodos específicos para BATUZ BIZKAIA

Otros métodos