API > Nueva factura FacturaE
Nueva factura FacturaE
POST https://{entorno}.ticketbaiws.eus/facturae/
Método disponible únicamente bajo petición. Se requiere de un certificado digital del cliente para poder firmar las facturas.
Este método permite generar una factura electrónica firmada digitalmente con el estandar FacturaE 3.2.
La factura en formato XML se devuelve encapsulada mediante base64.
PARÁMETROS
| fecha string obligatorio Fecha de la factura en formato dd/mm/yyyy | 13/11/2021 | ||||||||
| hora string obligatorio Hora de emisión de la factura en formato HH:MM:SS | 12:14:00 | ||||||||
| nif string obligatorio NIF del cliente al que se le emite la factura | B01000012 | ||||||||
| nombre string obligatorio Nombre social del cliente al que se le emite la factura | Empresa de ejemplo S.L. | ||||||||
| direccion string obligatorio Dirección de facturación del cliente al que se le emite la factura | Calle de ejemplo 123 | ||||||||
| cp string obligatorio Código postal del cliente al que se le emite la factura | 12:14:00 | ||||||||
| serie string obligatorio Serie de la factura | A | ||||||||
| numero string obligatorio Número de factura | 2021000123 | ||||||||
lineas object obligatorio
| |||||||||
| total_factura float obligatorio Importe total de la factura | 132.00 | ||||||||
POST https://{entorno}.ticketbaiws.eus/facturae/
$ curl --request POST \
--url https://api-test.ticketbaiws.eus/facturae/ \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Token: xxx' \
--header 'Nif: 00000014Z'
--data '
{
"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",
"lineas": [
{
"descripcion": "Producto normal",
"cantidad": 1,
"importe_unitario": 100.00,
"tipo_iva": 21.00
},
{
"descripcion": "Producto alimentario",
"cantidad": 1,
"importe_unitario": 10,
"tipo_iva": 10.00
}
],
"total_factura": 132.00
}'
$ composer require guzzlehttp/guzzle
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://api-test.ticketbaiws.eus/facturae/', [
'body' => '{"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","simplificada":false,"rectificativa":false,"importacion":false,"intracomunitaria":false,"retencion":0,"lineas":[{"descripcion":"Producto normal","cantidad":1,"importe_unitario":100.00,"tipo_iva":21.00,"tipo_req":0},{"descripcion":"Producto alimentario","cantidad":1,"importe_unitario":10,"tipo_iva":10.00,"tipo_req":0}],"total_factura":132.00}',
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'Token' => 'xxx',
'Nif' => '00000014Z'
],
]);
echo $response->getBody();
$ python -m pip install requests
import requests
url = "https://api-test.ticketbaiws.eus/facturae/"
payload = {
"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",
"lineas": [
{
"descripcion": "Producto normal",
"cantidad": 1,
"importe_unitario": 100.00,
"tipo_iva": 21.00
},
{
"descripcion": "Producto alimentario",
"cantidad": 1,
"importe_unitario": 10,
"tipo_iva": 10.00
}
],
"total_factura": 132.00
}
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/facturae/");
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","lineas":[{"descripcion":"Producto normal","cantidad":1,"importe_unitario":100.00,"tipo_iva":21.00,"tipo_req":0},{"descripcion":"Producto alimentario","cantidad":1,"importe_unitario":10,"tipo_iva":10.00,"tipo_req":0}],"total_factura":132.00}');
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","lineas":[{"descripcion":"Producto normal","cantidad":1,"importe_unitario":100.00,"tipo_iva":21.00,"tipo_req":0},{"descripcion":"Producto alimentario","cantidad":1,"importe_unitario":10,"tipo_iva":10.00,"tipo_req":0}],"total_factura":132.00}');
Request request = new Request.Builder()
.url("https://api-test.ticketbaiws.eus/facturae/")
.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": {
"facturae" : "iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAIAAABEtEjdAAAABmJ..."
},
"msg": null
}
Métodos TicketBAI / Verifactu
- POST Nueva factura / subsanación (zuzendu) TicketBAI / Verifactu
- POST Completar factura simplificada
- GET Consulta factura TicketBAI / Verifactu
- GET Listado facturas TicketBAI / Verifactu
- GET Descarga XML TicketBAI / Verifactu
- GET Descarga factura en formato FacturaE
- GET Descarga factura en PDF
- GET Estado sistema
- DEL Anular factura TicketBAI / Verifactu
- PUT Forzar reenvío TicketBAI / Verifactu
- POST Validar NIF en la AEAT
- POST Validar NIF en el VIES
Métodos específicos para Verifactu
- GET Documento Representación Verifactu - Descargar modelo
- POST Documento Representación Verifactu - Enviar documento
- GET Documento Representación Verifactu - Descargar documento cargado
- DELETE Documento Representación Verifactu - Revocar documento cargado
Métodos específicos para BATUZ BIZKAIA
- GET Listado de epígrafes
- POST LROE - Facturas recibidas - Envío (BATUZ)
- PUT LROE - Facturas recibidas - Modificar (BATUZ)
- GET LROE - Facturas recibidas - Consulta (BATUZ)
- DEL LROE - Facturas recibidas - Anular (BATUZ)
- POST LROE - Criterio Caja COBROS - Envío (BATUZ)
- PUT LROE - Criterio Caja COBROS - Modificar (BATUZ)
- GET LROE - Criterio Caja COBROS - Consulta (BATUZ)
- DEL LROE - Criterio Caja COBROS - Anular (BATUZ)
- POST LROE - Criterio Caja PAGOS - Envío (BATUZ)
- PUT LROE - Criterio Caja PAGOS - Modificar (BATUZ)
- GET LROE - Criterio Caja PAGOS - Consulta (BATUZ)
- DEL LROE - Criterio Caja PAGOS - Anular (BATUZ)
