[NOTE] This document is also available in English.
Librería para consumir la API Web y API Multiemisor de Facturama.
Puedes consultar la guía completa de la API.
Librería para consumir la API Web y API Multiemisor de Facturama
Puedes consultar la guía completa de la API
Crear una cuenta de usuario en el ambiente de pruebas Sandbox
Para API Web, realiza la configuración básica usando RFC de pruebas "EKU9003173C9", más información aquí
Consulta los Sellos Digitales de prueba (CSD) aquí
Crear una cuenta en ambiente de Producción
Para realizar cualquier llamada a la API deberá generar su token de autentificación basic a partir de su usuario y contraseña
Las credenciales son construidas de esta forma:
El usuario y la contraseña se combinan uniendo con dos puntos ( tu_usuario:tu_contraseña ) y posteriomente se debe conbertir en formato base64
Este es el resultado despues de la conversión (dXN1YXJpbzpwcnVlYmFz......)
"Authorization: Basic dXN1YXJpbzpwcnVlYmFz....."
Coloca en ednpoint,tu token y nombre de usuario en el script facturama.api.js o facturama.api.multiemisor.js
Sandbox = https://apisandbox.facturama.mx/
Producción = https://api.facturama.mx/
var valuesFacturama =
{
token: "dXN1YXJpbzpwcnVlYmFz......",
url: "https://apisandbox.facturama.mx/",
useragent: "tu_usuario",
};
- jQuery http://jquery.com/
Creación de CFDI con un único emisor, (el propietario de la cuenta cuyo Perfil Fiscal se tiene configurado)
Todas las operaciones son reflejadas en la plataforma web.
Crear
Consultar
Cancelar
Descargar (XML y PDF)
Enviar por correo
Consultar Perfil
Suscripción actual
Carga de Logo
Certificados Digitales
Catalogos de clientes y productos
CRUD de Productos, Clientes, Sucursales y Series
var newClient =
{
"Id": "",
"Rfc": "URE180429TM6",
"Name": "UNIVERSIDAD ROBOTICA ESPAÑOLA",
"FiscalRegime": "601",
"Email": "[email protected]",
"CfdiUse": "G03",
"TaxResidence": "65000",
"NumRegIdTrib": "131494-1055",
"TaxZipCode": "65000",
"Address":
{
"Street": "Calle de Pruebas",
"ExteriorNumber": "123",
"InteriorNumber": "456",
"Neighborhood": "COLOMBIA",
"ZipCode": "65000",
"Locality": "NUEVO LEON",
"Municipality": "ANAHUAC",
"State": "NUEVO LEON",
"Country": "Mex"
},
};
Facturama.Clients.Create(newClient, function (result, textStatus, status)
{
console.log("Nuevo =>", result);
console.log("Estado =>", status.status);
},
function (error)
{
console.log("Código de respuesta: " + error.status);
console.log("Mensaje: " + error.messege);
}
);
var IdClient = "1CMATRSzNovIpge-mkzwFw2";
Facturama.Clients.Remove(IdClient, function (result, textStatus, status) {
console.log("Eliminado", result);
console.log("Estado =>", status.status);
});
var UpdateClient =
{
"Id":"GJ5YJi5rz_-uCcFbfOATDQ2",
"Rfc": "URE180429TM6",
"Name": "UNIVERSIDAD ROBOTICA ESPAÑOLA",
"FiscalRegime": "601",
"Email": "[email protected]",
"CfdiUse": "G03",
"TaxResidence": "86991",
"NumRegIdTrib": "9999999999",
"TaxZipCode": "65000",
"Address":
{
"Street": "Calle de Pruebas",
"ExteriorNumber": "123",
"InteriorNumber": "456",
"Neighborhood": "COLOMBIA",
"ZipCode": "86991",
"Locality": "NUEVO LEON",
"Municipality": "ANAHUAC",
"State": "NUEVO LEON",
"Country": "Mex"
},
};
cliente_id="GJ5YJi5rz_-uCcFbfOATDQ2";
Facturama.Clients.Update(client_Id, client, function (result, textStatus, status)
{
console.log("Edición", result);
if (status.status == 204){alert("Datos Actualizados");}
console.log("Estado =>", status.status);
}, function (error)
{
console.log("Código de respuesta: " + error.status);
console.log("Mensaje: " + error.messege);
});
Facturama.Clients.List(function (result, textStatus, status)
{
clientUpdate = result;
console.log("Todos", result);
console.log("Estado =>", status.status);
});
var search="";
var start=0;
var length=100;
Facturama.Clients.List2("start="+start+"&lenght="+length +"&search="+search,function (result)
{console.log(result);};
client_Rfc="URE180429TM6";
Facturama.Clients.Get(client_Rfc, function(result)
{console.log("Obtener",result); });
client_Id="GJ5YJi5rz_-uCcFbfOATDQ2";
Facturama.Clients.Get(client.Id, function(result)
{console.log("Obtener",result); });
var newProduct = {
"Unit": "Servicio",
"UnitCode": "E48",
"IdentificationNumber": "WEB003",
"Name": "Sitio Web CMS",
"Description": "Desarrollo e implementación de sitio web empleando un CMS",
"Price": 6500.0,
"CodeProdServ": "43232408",
"CuentaPredial": "123",
"Taxes": [
{
"Name": "IVA",
"Rate": 0.16,
"IsRetention": false,
"IsFederalTax": true
},
{
"Name": "ISR",
"IsRetention": true,
"IsFederalTax": true,
"Total": 0.1
},
{
"Name": "IVA",
"IsRetention": true,
"IsFederalTax": true,
"Total": 0.106667
}
]
};
Facturama.Products.Create(newProduct, function(result, textStatus, status)
{
console.log("Nuevo",result);
console.log("Estado =>", status.status);
}, function (error)
{
console.log("Código de respuesta: " + error.status);
console.log("Mensaje: " + error.messege);
});
Facturama.Products.List(function(result)
{ console.log("Todos",result);});
var search= "";
var start=0;
var length=100;
Facturama.Products.List2("start="+start+"&lenght="+length +"&search="+search,function (result)
{
console.log(result);
};
product_Id="yogmRnclhMckG5tlFmtAlg2",
Facturama.Products.Get(product_Id, function(result)
{ console.log("Obtener",result); });
var producto=
{
"Id": "yogmRnclhMckG5tlFmtAlg2",
"Unit": "Servicio",
"UnitCode": "E48",
"IdentificationNumber": "WEB003",
"Name": "Sitio Web CMS",
"Description": "Desarrollo e implementación de sitio web empleando un CMS",
"Price": 6500.0,
"CodeProdServ": "43232408",
"CuentaPredial": "123",
"Taxes": [
{
"Name": "IVA",
"Rate": 0.16,
"IsRetention": false,
"IsFederalTax": true
},
{
"Name": "ISR",
"IsRetention": true,
"IsFederalTax": true,
"Total": 0.1
},
{
"Name": "IVA",
"IsRetention": true,
"IsFederalTax": true,
"Total": 0.106667
}
]
};
}
product_Id="yogmRnclhMckG5tlFmtAlg2",
Facturama.Products.Update(product_Id, producto, function(result, textStatus, status)
{
console.log("Eliminado", result);
console.log("Estado =>", status.status);
});
product_Id="yogmRnclhMckG5tlFmtAlg2",
Facturama.Products.Remove(product_Id, function(rresult, textStatus, status)
{
console.log("Eliminado", result);
console.log("Estado =>", status.status);
});
var newBranch = {
"Name": "El sauce",
"Description": "Sucursal del sauce, enfocada en la distribución de agua en garrafón",
"Address": {
"Street": "Av. del Sauce",
"ExteriorNumber": "120",
"InteriorNumber": "",
"Neighborhood": "Las Flores",
"ZipCode": "78116",
"Locality": "",
"Municipality": "San Luis Potosi",
"State": "San Luis Potosi",
"Country": "México"
}
};
Facturama.BranchOffice.Create(newBranch,function (result, textStatus, status)
{
console.log("Nuevo =>", result);
console.log("Estado =>", status.status);
},function (error)
{
console.log("Código de respuesta: " + error.status);
console.log("Mensaje: " + error.messege);
});
Facturama.BranchOffice.List(function(result)
{ console.log("Todos",result); });
Facturama.TaxEntity.Get(function(result, textStatus, status)
{
console.log("Datos cuenta ",result);
console.log("Estado =>", status.status);
});
var newCsd = {
"Certificate": "MIIF+TCCA+GgAwIBAgIUMzAwMDEwMDAwMDAzMDAwMjM3MDEwDQYJKoZIhvcNAQELBQAwggFmMSAwHgYDVQQDDBdBLkMuIDIgZGUgcHJ1ZWJhcyg0MDk2KTEvMC0GA1UECgwmU2VydmljaW8gZGUgQWRtaW5pc3RyYWNpw7NuIFRyaWJ1dGFyaWExODA2BgNVBAsML0FkbWluaXN0cmFjacOzbiBkZSBTZWd1cmlkYWQgZGUgbGEgSW5mb3JtYWNpw7NuMSkwJwYJKoZIhvcNAQkBFhphc2lzbmV0QHBydWViYXMuc2F0LmdvYi5teDEmMCQGA1UECQwdQXYuIEhpZGFsZ28gNzcsIENvbC4gR3VlcnJlcm8xDjAMBgNVBBEMBTA2MzAwMQswCQYDVQQGEwJNWDEZMBcGA1UECAwQRGlzdHJpdG8gRmVkZXJhbDESMBAGA1UEBwwJQ295b2Fjw6FuMRUwEwYDVQQtEwxTQVQ5NzA3MDFOTjMxITAfBgkqhkiG9w0BCQIMElJlc3BvbnNhYmxlOiBBQ0RNQTAeFw0xNzA1MTgwMzU0NTFaFw0yMTA1MTgwMzU0NTFaMIHlMSkwJwYDVQQDEyBBQ0NFTSBTRVJWSUNJT1MgRU1QUkVTQVJJQUxFUyBTQzEpMCcGA1UEKRMgQUNDRU0gU0VSVklDSU9TIEVNUFJFU0FSSUFMRVMgU0M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M3GwAMHAiJQl9UevyKe6rlvAIDlop6l3M02m5hHUXUpPjz4j7inFXZzvSv0tFoSbEqGgno0Pa+0gWHqRwBEGLGEwHVfyEy+Of8g4+0jzo0jNPIcurA5xRh9HSRSAd3kdEhx75eeVL7lBdLjRUkbtRtg7nelSjqAX7tQZK6Awp5C/17W96+f/vtjB+Y+ZgrSUjnQDADnZCnapIrzHgE3ZanhGAtnMMl+o4aLd1+74inG4jht/GJB60raSQfYrDrM3kBs0oyfpbEk5TI8ISzRlRmejv+mqpTogJaAqhnLP7rAli3d4pRhUjbACn/xQSFKxl2OURdmnMlvlbb6pleXviJHRxzPPQ25NVdWvmCYWrDfAZYn8X1sABOdyrth38BfmAVsyyPATYFB+5cXuNIZkPz1swz3859iZWTn5JRfPEAGICu5G6w6nrgOLYM9UqOPmxofzEdiEPafLQ5orMxdSWF6+3mD2Yw/VP+B43B/oYehgfrYjBUJt2D04VU/v8XK1ZUVgX/Co0odcdcszAP+ljQ7UVhW+uxVMd2sEprwepPPjYT3HvdI6RBB94yYBWfkoCSo/jsrrRpw2DVEyvoDp/hOXKyt8Y/8UGLCxJUhhv5fEiezYnlUAmwAGjgZfzfAErx0gkQFBgNKglEA7jz0Dqc2Z92pGVGTyPtXqRsqX3IYX5WsZVUoJim0wI7+LNmKpu147ePC0G4Sf4AGoZyPWVXq2SZSPpN261pIKSoLEDeA8WIKj2U5JG2DMMYokV0bZ1TsabrwHvwsp3muLnaP8L+n2fBplbhAEE2buBXvsATixMGu57ZI5WKFLnHn4KIBrZzALCtGehfFbCsdf1nBR6aAt+BpWhhZki54fZTurgMr6zuC5hAaP4rExW+LCc3upHMW7R9DcHWaZuZIfwnVDImnAQ9UOsz+A=",
"PrivateKeyPassword": "12345678a"
};
Facturama.TaxEntity.UploadCsd(newCsd, function(result)
{
clientUpdate = result;
console.log("Carga de CSD",result);
Facturama.TaxEntity.Get(function(result)
{
taxentity = result;
onsole.log("Datos cuenta modif",result);
});
},
function(error)
{
if (error && error.responseJSON)
{
console.log("errores", error.responseJSON);
}
});
Facturama.SuscriptionPlan.Get(function (result, textStatus, status)
{
console.log("Obtener =>", result);
console.log("Estado =>", status.status);
});
var newCfdi40=
{
"NameId":"1",
"Folio": "100",
"CfdiType": "I",
"Serie": "FAC",
"Currency": "MXN",
"PaymentForm": "03",
"PaymentMethod": "PUE",
"Exportation": "01",
"OrderNumber": "TEST-001",
"Date": "2023-04-01T12:00:00-06:00",
"ExpeditionPlace": "99999",
//"CurrencyExchangeRate": 20.55,
"PaymentConditions": "CREDITO A SIETE DIAS",
"Observations": "Elemento Observaciones solo visible en PDF",
"Receiver":
{
"Rfc": "ZUÑ920208KL4",
"Name": "ZAPATERIA URTADO ÑERI",
"CfdiUse": "G03",
"FiscalRegime": "601",
"TaxZipCode": "34541"
},
"Items":
[{
"ProductCode": "10101504",
"IdentificationNumber": "EDL",
"Description": "Estudios de viabilidad",
"Unit": "NO APLICA",
"UnitCode": "MTS",
"UnitPrice": 50.0,
"Quantity": 2.0,
"Subtotal": 100.0,
"TaxObject": "02",
"Taxes": [{
"Total": 16.0,
"Name": "IVA",
"Base": 100.0,
"Rate": 0.16,
"IsRetention": false
}],
"Total": 116.0
},
{
"ProductCode": "10101504",
"IdentificationNumber": "001",
"Description": "SERVICIO DE COLOCACION",
"Unit": "NO APLICA",
"UnitCode": "E49",
"UnitPrice": 100.0,
"Quantity": 15.0,
"Subtotal": 1500.0,
"Discount": 0.0,
"TaxObject":"01",
"Total": 1500.0
}
]
};
Facturama.Cfdi.Create3(newCfdi40, function(result)
{ console.log("Creación",result); });
var cfdiInicial =
{
"NameId":"1",
"Folio": "100",
"CfdiType": "I",
"Serie": "FAC",
"Currency": "MXN",
"PaymentForm": "03",
"PaymentMethod": "PUE",
"Exportation": "01",
"OrderNumber": "TEST-001",
"Date": "2023-04-01T12:00:00-06:00",
"ExpeditionPlace": "99999",
//"CurrencyExchangeRate": 20.55,
"PaymentConditions": "CREDITO A SIETE DIAS",
"Observations": "Elemento Observaciones solo visible en PDF",
"Receiver":
{
"Rfc": "ZUÑ920208KL4",
"Name": "ZAPATERIA URTADO ÑERI",
"CfdiUse": "G03",
"FiscalRegime": "601",
"TaxZipCode": "34541"
},
"Items": [
{
"ProductCode": "10101504",
"IdentificationNumber": "EDL",
"Description": "Estudios de viabilidad",
"Unit": "NO APLICA",
"UnitCode": "MTS",
"UnitPrice": 1281.69,
"Quantity": 1.0,
"Subtotal": 1281.69,
"Discount": 0,
"TaxObject":"02",
"Taxes":
[
{
"Total": 205.07,
"Name": "IVA",
"Base": 1281.69,
"Rate": 0.16,
"IsRetention": false
}
],
"Total": 1486.76
}
]
};
var complementoPago =
{
"NameId": "14",
"Folio": "CP-100",
"Currency": "MXN",
"ExpeditionPlace": "99999",
"CfdiType": "P",
"PaymentForm": null,
"PaymentMethod": null,
"PaymentConditions": null,
"Receiver":
{
"Rfc": "ZUÑ920208KL4",
"Name": "ZAPATERIA URTADO ÑERI",
"CfdiUse": "CP01",
"FiscalRegime": "601",
"TaxZipCode": "77060"
},
"Complemento":
{
"Payments":
[
{
"Date": "2019-06-20", // Fecha del pago
"PaymentForm": "03", // Forma en que se ha recibido el pago (no tiene que ver el CFDI Inicial)
"Amount": "1486.76", // Monto de la factura oroginal
"RelatedDocuments":
[
{
"TaxObject": "01",
"Uuid": "C94C8AF3-C774-4D4C-802E-781411934A6E",
"Serie": "C",
"Folio": "300",
"Currency": "MXN", // Se ejempifica pagando en dolares, (en el caso de que el pago sea con la misma moneda que el cfdi inicial, no lleva ExchangeRate)
"PaymentMethod": "PUE",
"PartialityNumber": "1", // Número de Parcialidad
"PreviousBalanceAmount": "1486.76", // Lo que faltaba por pagar
"AmountPaid": "1486.76", // Lo que se paga
"ImpSaldoInsoluto": "0.00" // Lo que resta por pagar
"Taxes": [
{
"Name": "IVA",
"Rate": "0.16",
"Total": 205.07,
"Base": 1281.69,
"IsRetention": "false"
}
]
}]
}]
}
};
var cfdi;
Facturama.Cfdi.Create3(cfdiInicial, function(result)
{ cfdi = result;
console.log("Creacion de cfdi inicial",result);
});
// Creacion del CFDI "Complemento de pago", referencía al CFDI Inicial (mediante el UUID) y representa uno de los pagos realizados.
omplementoPago.Complemento.Payments[0].RelatedDocuments[0].Uuid = cfdi.Complement.TaxStamp.Uuid; // Relacionado con el UUID del cfdi inicial
Facturama.Cfdi.Create3(complementoPago, function(complemento)
{ console.log("creacion de complemento de pago: ",complemento); });
//eliminar el cfdi creado
var Cfdi_Id="4DvIUITxTOngiXUsxC28nA2";
var _type="issued"; //Valores posibles (issued | payroll)
var _motive="02"; //Valores Posibles (01|02|03|04)
Facturama.Cfdi.Cancel(Cfdi_Id + `?type=${_type}&motive=${_motive}`, function(result, textStatus, status)
{
console.log("Eliminado", result);
console.log("Estado =>", status.status);
});
//eliminar el cfdi creado
var Cfdi_Id="4DvIUITxTOngiXUsxC28nA2";
var _type="issued"; //Valores posibles (issued | payroll)
var _motive="01"; //Valores Posibles (01|02|03|04)
var _uuidReplacement="C94C8AF3-C774-4D4C-802E-781411934A6E"; //(uuid | null)
Facturama.Cfdi.Cancel(Cfdi_Id +`?type=${_type}&motive=${_motive}&uuidReplacement=${_uuidReplacement}` +_uuidReplacement , function(result)
{ console.log("Eliminado",result);});
Facturama.Cfdi.Download("pdf", "issued", cfdi.Id, function(result){...});
Facturama.Cfdi.Download("xml", "issued", cfdi.Id, function(result){...});
var rfc = "XEXX010101000";
Facturama.Cfdi.List("?type=issued&keyword=" + rfc, function(result){...});
var email = "[email protected]";
var type = "issued";
var Cfdi_Id="4DvIUITxTOngiXUsxC28nA2";
//console.log("Id del la factura: ",Cfdi_Id);
Facturama.Cfdi.Send("?cfdiType=" + type + "&cfdiId=" + Cfdi_Id + "&email=" + email, function(result)
{console.log("envio", result); });
Creación de CFDIs con múltiples emisores.
Las operaciones NO se reflejan en la plataforma web.
Crear
Consultar
Cancelar
Descarga de XML
CRUD de CSD (Certificados de los Sellos Digitales).
var newCsd = {
"Rfc": "EKU9003173C9",
"Certificate": "MIIFsDC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PAQHgSp9+TwqI0Uswb7cEiXnN8PySN5Tk109CYJjKqCxtuXu+oOeQV2I/0knQLd2zol+yIzNLj5a/HvyN+kOhIGi6TrFThuiVbbtnTtRM1CzKtFGuw5lYrwskkkvenoSLNY0N85QCU8ugjc3Bw4JZ9jNrDUaJ1Vb5/+1GQx/q/Dbxnl+FK6wMLjXy5JdFDeQyjBEBqndQxrs9cM5xBnl6AYs2Xymydafm2qK0cEDzwOPMpVcKU8sXS/AHvtgsn+rjMzW0wrQblWE0Ht/74GgfCj4diCDtzxQ0ggi6yJD+yhLZtVVqmKS3Gwnj9RxPLNfpgzPP01eYyBBi/W0RWTzcTb8iMxWX52MTU0oX9//4I7CAPXn0ZhpWAAIvUmkfjwfEModH7iwwaNtZFlT2rlzeshbP++UCEtqbwvveDRhmr5sMYkl+duEOca5156fcRy4tQ8Y3moNcKFKzHGMenShEIHz+W5KE=",
"PrivateKeyPassword": "12345678a"
};
Facturama.Certificates.Create(newCsd, function (result, textStatus, status)
{
certif = result;
console.log("Se agrega nuevo RFC y CSD,", result);
console.log("Estado =>", status.status);
}, function (error) {
if (error && error.responseJSON) {
console.log("errores", error.responseJSON);
}
});
Facturama.Certificates.List(function (result) {
console.log("Todos los CSD ", result);
});
Facturama.Certificates.Get("EKU9003173C9", function (result) {
certif = result;
console.log("Obtener CSD de un RFC ", result);
});
Facturama.Certificates.Remove("EKU9003173C9", function (result) {
console.log("se elimino", result);
}, function (error) {
if (error && error.responseJSON) {
console.log("errores", error.responseJSON);
}
});
newCsd.PrivateKeyPassword = "12345678a";
Facturama.Certificates.Update("EKU9003173C9", newCsd, function (result) {
certif = result;
console.log("actualización csd", result);
}, function (error) {
if (error && error.responseJSON) {
console.log("errores", error.responseJSON);
}
});
}
var newCfdi = {
"NameId":"1",
"Folio": "100",
"CfdiType": "I",
"Serie": "FAC",
"Currency": "MXN",
"PaymentForm": "03",
"PaymentMethod": "PUE",
"Exportation": "01",
"OrderNumber": "TEST-001",
"Date": "2023-04-01T12:00:00-06:00",
"ExpeditionPlace": "99999",
//"CurrencyExchangeRate": 20.55,
"PaymentConditions": "CREDITO A SIETE DIAS",
"Observations": "Elemento Observaciones solo visible en PDF",
"Issuer":{
"Rfc": "URE180429TM6",
"Name": "UNIVERSIDAD ROBOTICA ESPAÑOLA",
"FiscalRegime": "601"
},
"Receiver":
{
"Rfc": "EKU9003173C9",
"Name": "ESCUELA KEMPER URGATE",
"CfdiUse": "P01",
"FiscalRegime": "603",
"TaxZipCode": "42501"
},
"Items": [
{
"ProductCode": "10101504",
"IdentificationNumber": "EDL",
"Description": "Estudios de viabilidad",
"Unit": "NO APLICA",
"UnitCode": "MTS",
"UnitPrice": 50.0,
"Quantity": 2.0,
"Subtotal": 100.0,
"TaxObject": "02",
"Taxes": [{
"Total": 16.0,
"Name": "IVA",
"Base": 100.0,
"Rate": 0.16,
"IsRetention": false
}],
"Total": 116.0
},
{
"ProductCode": "10101504",
"IdentificationNumber": "001",
"Description": "SERVICIO DE COLOCACION",
"Unit": "NO APLICA",
"UnitCode": "E49",
"UnitPrice": 100.0,
"Quantity": 15.0,
"Subtotal": 1500.0,
"Discount": 0.0,
"TaxObject":"02",
"Taxes": [{
"Total": 240.0,
"Name": "IVA",
"Base": 1500.0,
"Rate": 0.16,
"IsRetention": false
}],
"Total": 1740.0
}
]
};
Facturama.Cfdi.Create3(newCfdi, function(result, textStatus, status)
{
cfdi = result;
console.log("Creación =>", result);
console.log("Estado =>", status.status);
}, function(error)
{
if (error && error.responseJSON)
{
console.log("errores", error.responseJSON);
}
});