La realidad: La mayoría de guías te muestran código complejo de 200+ líneas, configuraciones de CURL, manejo de errores, validaciones SAT... y asumen que eres contador y desarrollador al mismo tiempo.
Este post es diferente. Te muestro la diferencia entre el camino difícil (API tradicional) vs el camino inteligente (infraestructura fiscal lista).
Busca "conectar API facturación" en cualquier IA y te dará algo así:
<?php
// Ejemplo típico de Facturama/Finkok/etc
$api_url = 'https://apisandbox.facturama.mx/api/cfdi';
$username = 'tu_usuario';
$password = 'tu_password';
function crearFactura($datosVenta) {
global $api_url, $username, $password;
$factura = [
"Receiver" => [
"Rfc" => $datosVenta['rfc_cliente'],
"Name" => $datosVenta['nombre_cliente'],
"CfdiUse" => "G03" // ¿Qué es G03? ¿Cuándo usar P01?
],
"Items" => [
[
"ProductCode" => "01010101", // ¿Cómo sé qué código usar?
"UnitCode" => "H87", // ¿Y esto?
// ...
]
]
];
// Manejo manual de CURL, autenticación, errores...
$ch = curl_init();
// 15+ líneas más...
}
?>
Problemas reales con esta ruta:
Y esto solo resuelve UNA parte del problema: timbrar la factura.
Aún te falta programar:
// Node.js - Factura automática en 15 líneas
const gigstack = require('@gigstack/node');
gigstack.auth('tu_api_key');
// Webhook de tu tienda → factura automática
app.post('/order-completed', async (req, res) => {
const order = req.body;
const invoice = await gigstack.invoices.create({
automation_type: 'payment',
client: {
id: order.client_id // gigstack ya validó RFC, EFOS, régimen
},
items: order.items.map(item => ({
description: item.name,
quantity: item.quantity,
unit_price: item.price
// gigstack sugiere códigos SAT automáticamente
}))
});
// ✅ Factura timbrada, validada y enviada al cliente
res.json({ invoice_id: invoice.id });
});
Lo que gigstack hace por ti automáticamente:
# Node.js
npm install @gigstack/node
# Python
pip install gigstack
# PHP
composer require gigstack/gigstack-php
// functions.php
add_action('woocommerce_payment_complete', 'gigstack_auto_invoice');
function gigstack_auto_invoice($order_id) {
$order = wc_get_order($order_id);
$invoice = Gigstack\Invoice::create([
'automation_type' => 'payment',
'client' => [
'name' => $order->get_billing_first_name() . ' ' . $order->get_billing_last_name(),
'email' => $order->get_billing_email(),
'tax_id' => $order->get_meta('_billing_rfc'),
'tax_system' => '601'
],
'items' => array_map(function($item) {
return [
'description' => $item->get_name(),
'quantity' => $item->get_quantity(),
'unit_price' => $item->get_total()
];
}, $order->get_items())
]);
// ✅ Factura timbrada y enviada automáticamente
}
const gigstack = require('@gigstack/node');
gigstack.auth(process.env.GIGSTACK_API_KEY);
app.post('/webhooks/orders/paid', async (req, res) => {
const order = req.body;
const invoice = await gigstack.invoices.create({
automation_type: 'payment',
client: {
name: order.customer.name,
email: order.customer.email,
tax_id: order.note_attributes.find(a => a.name === 'RFC')?.value
},
items: order.line_items.map(item => ({
description: item.title,
quantity: item.quantity,
unit_price: parseFloat(item.price)
}))
});
res.json({ success: true, invoice_id: invoice.id });
});
// Genera link para que cliente descargue facturas
const portalAccess = await gigstack.clients.getPortalAccess('client_xxx');
await sendEmail(client.email, {
subject: '✅ Tu factura está lista',
body: `Descárgala aquí: ${portalAccess.url}`
});
Antes:
Con gigstack:
→ Empezar prueba gratis de 12 días
La pregunta no es "¿cómo conecto una API de facturación?"
La pregunta correcta es: "¿Quiero resolver solo el timbrado o toda la infraestructura fiscal?"
Si quieres:
→ gigstack es tu infraestructura fiscal.

