Copia, pega, adapta. En 10 minutos estás facturando.
PHP / Laravel
Python
Node.js
Java
C# / .NET
cURL
// PHP — con cURL nativo o Laravel Http
// Opción 1: Laravel Http (recomendado)
use Illuminate\Support\Facades\Http ;
$response = Http ::withHeaders ([
'x-api-key' => $apiKey ,
'x-api-secret' => $apiSecret ,
])->post ('https://facturalo.pro/api/v1/comprobantes' , [
'tipo_comprobante' => '03' , // 03 = Boleta
'cliente' => [
'tipo_documento' => '1' , // 1 = DNI
'numero_documento' => '12345678' ,
],
'items' => [[
'descripcion' => 'Cuota mensual colegiatura' ,
'cantidad' => 1 ,
'precio_unitario' => 150.00 ,
]],
]);
$data = $response ->json ();
// $data['serie'] → "B001-00000042"
// $data['estado'] → "aceptado"
// $data['pdf_url'] → URL de descarga
// Opción 2: PHP nativo con cURL
$ch = curl_init ('https://facturalo.pro/api/v1/comprobantes' );
curl_setopt_array ($ch , [
CURLOPT_POST => true ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json' ,
'x-api-key: ' . $apiKey ,
'x-api-secret: ' . $apiSecret ,
],
CURLOPT_POSTFIELDS => json_encode ($payload ),
]);
$result = json_decode (curl_exec ($ch ), true );
# Python — con requests o httpx
import requests
response = requests.post (
"https://facturalo.pro/api/v1/comprobantes" ,
headers={
"x-api-key" : API_KEY,
"x-api-secret" : API_SECRET,
},
json={
"tipo_comprobante" : "03" ,
"cliente" : {
"tipo_documento" : "1" ,
"numero_documento" : "12345678" ,
},
"items" : [{
"descripcion" : "Cuota mensual colegiatura" ,
"cantidad" : 1 ,
"precio_unitario" : 150.00 ,
}],
}
)
data = response.json ()
print (data["serie" ]) # B001-00000042
print (data["estado" ]) # aceptado
print (data["pdf_url" ]) # URL de descarga
// Node.js — con fetch (v18+) o axios
const response = await fetch ("https://facturalo.pro/api/v1/comprobantes" , {
method : "POST" ,
headers : {
"Content-Type" : "application/json" ,
"x-api-key" : process.env.API_KEY ,
"x-api-secret" : process.env.API_SECRET ,
},
body : JSON.stringify ({
tipo_comprobante : "03" ,
cliente : {
tipo_documento : "1" ,
numero_documento : "12345678" ,
},
items : [{
descripcion : "Cuota mensual colegiatura" ,
cantidad : 1 ,
precio_unitario : 150.00 ,
}],
}),
});
const data = await response.json ();
console.log (data.serie); // B001-00000042
console.log (data.estado); // aceptado
console.log (data.pdf_url); // URL de descarga
// Java — con HttpClient (Java 11+)
import java.net.http.*;
import java.net.URI;
String json = """
{
"tipo_comprobante": "03",
"cliente": {
"tipo_documento": "1",
"numero_documento": "12345678"
},
"items": [{
"descripcion": "Cuota mensual colegiatura",
"cantidad": 1,
"precio_unitario": 150.00
}]
}
""" ;
HttpRequest request = HttpRequest .newBuilder ()
.uri (URI.create ("https://facturalo.pro/api/v1/comprobantes" ))
.header ("Content-Type" , "application/json" )
.header ("x-api-key" , apiKey)
.header ("x-api-secret" , apiSecret)
.POST (HttpRequest.BodyPublishers .ofString (json))
.build ();
HttpResponse <String > response = client.send (
request, HttpResponse.BodyHandlers .ofString ()
);
System.out.println (response.body ());
// {"exito": true, "serie": "B001-00000042", "estado": "aceptado"}
// C# / .NET — con HttpClient
using System.Net.Http;
using System.Text;
using System.Text.Json;
var client = new HttpClient ();
client.DefaultRequestHeaders.Add ("x-api-key" , apiKey);
client.DefaultRequestHeaders.Add ("x-api-secret" , apiSecret);
var payload = new {
tipo_comprobante = "03" ,
cliente = new {
tipo_documento = "1" ,
numero_documento = "12345678"
},
items = new [] {
new {
descripcion = "Cuota mensual colegiatura" ,
cantidad = 1 ,
precio_unitario = 150.00
}
}
};
var content = new StringContent (
JsonSerializer .Serialize (payload),
Encoding .UTF8,
"application/json"
);
var response = await client.PostAsync (
"https://facturalo.pro/api/v1/comprobantes" , content
);
var result = await response.Content.ReadAsStringAsync ();
Console.WriteLine (result);
// {"exito": true, "serie": "B001-00000042", "estado": "aceptado"}
# cURL — para probar rápido desde la terminal
curl -X POST https://facturalo.pro/api/v1/comprobantes \
-H "Content-Type: application/json" \
-H "x-api-key: fpl_tu_api_key" \
-H "x-api-secret: tu_api_secret" \
-d '{
"tipo_comprobante": "03",
"cliente": {
"tipo_documento": "1",
"numero_documento": "12345678"
},
"items": [{
"descripcion": "Cuota mensual colegiatura",
"cantidad": 1,
"precio_unitario": 150.00
}]
}'