La estructura básica de un CFDI de API Web o de API Multiemisor es casi idéntica
Tomando en cuenta la estructura base (Web o Multiemisor), es fácil hacer otro tipo de comprobantes, pues en general se agregan algunos Atributos y/o Nodos
Tiene las variantes:
"NameId": "2" Nombre "Nota de crédito" de acuerdo al Catálogo de nombres del CFDI
"CfdiType": "E" Este campo adquiere el valor de E (Egreso)
"Relations" Se puede agregar opcionalmente el Nodo Relations para referenciar a un CFDI
"NameId": "2", "CfdiType": Facturama::CfdiType::EGRESO, "ExpeditionPlace": "78116", "PaymentForm": "03", "PaymentMethod": "PUE",
"Relations": { "Type": "01", "Cfdis": [{ "Uuid": "27568D31-7E57-442F-BA77-798CBF30BD7D" }] },
"NameId" => "2", "CfdiType" => "E", "ExpeditionPlace" => "78116", "PaymentForm" => "03", "PaymentMethod" => "PUE", "Currency" => "MXN",
"NameId": "2", "CfdiType": "E", "ExpeditionPlace": "78116", "PaymentForm": "03", "PaymentMethod": "PUE",
"Relations": { "Type": "01", "Cfdis": [{ "Uuid": "27568D31-7E57-442F-BA77-798CBF30BD7D" }] },
cfdi.setNameId(2); cfdi.setCfdiType( CfdiType.Egreso.getValue() ); cfdi.setExpeditionPlace("78216"); cfdi.setPaymentForm(facturama.Catalogs().PaymentForms().get(3).getValue()); cfdi.setPaymentMethod("PUE"); cfdi.setCurrency(currency.getValue());
CfdiRelations cfdiRel = new CfdiRelations(); cfdiRel.setUuid("27568D31-7E57-442F-BA77-798CBF30BD7D") List<CfdiRelations> lstCfdis = new new ArrayList<>(); lstCfdis.add(cfdiRel); CfdiRelation relation = new CfdiRelation(); relation.setType("01"); relation.setCfdis(lstCfdis); cfdi.setRelations(relation);
NameId = "2", CfdiType = CfdiType.Egreso, ExpeditionPlace = "78116", PaymentForm = "03", PaymentMethod = "PUE", Currency = "MXN",
Relations = new CfdiRelations { Type = "01", Cfdis = new List{ new CfdiRelation { Uuid = "27568D31-7E57-442F-BA77-798CBF30BD7D" } } },
"NameId": "2", "CfdiType": "E", "ExpeditionPlace": "78116", "PaymentForm": "03", "PaymentMethod": "PUE",
"Relations": { "Type": "01", "Cfdis": [{ "Uuid": "27568D31-7E57-442F-BA77-798CBF30BD7D" }] },
En el concepto o conceptos de la factura lleva los impuestos de:
"IVA RET" y "ISR" Ambos marcados como retención (IsRetention = true)
Nota: los impuestos de retencion se restan y los de traslado se suman
"NameId": "3", "CfdiType": Facturama::CfdiType::INGRESO, "ExpeditionPlace": "78116", "PaymentForm": "03", "PaymentMethod": "PUE",
"Taxes": [{ "Name": "IVA", "Rate": "0", "Total": "0", "Base": "100", "IsRetention": "false" }, { "Name": "IVA RET", "Rate": "0", "Total": "0", "Base": "100", "IsRetention": "true" }, { "Name": "ISR", "Rate": "0.1", "Total": "10", "Base": "100", "IsRetention": "true" }],
"NameId" => "3", "CfdiType" => "I", "ExpeditionPlace" => "78116", "PaymentForm" => "03", "PaymentMethod" => "PUE", "Currency" => "MXN", "Decimals" => "2",
"Taxes" => [{ "Name" => "IVA", "Rate" => "0", "Total" => "0", "Base" => "100", "IsRetention" => "false" }, { "Name" => "IVA RET", "Rate" => "0", "Total" => "0", "Base" => "100", "IsRetention" => "true" }, { "Name" => "ISR", "Rate" => "0.1", "Total" => "10", "Base" => "100", "IsRetention" => "true" }],
"NameId": "3", "CfdiType": "I", "ExpeditionPlace": "78116", "PaymentForm": "03", "PaymentMethod": "PUE",
"Taxes": [{ "Name": "IVA", "Rate": "0", "Total": "0", "Base": "100", "IsRetention": "false" }, { "Name": "IVA RET", "Rate": "0", "Total": "0", "Base": "100", "IsRetention": "true" }, { "Name": "ISR", "Rate": "0.1", "Total": "10", "Base": "100", "IsRetention": "true" }],
cfdi.setNameId(3); cfdi.setCfdiType( CfdiType.Ingreso.getValue() ); cfdi.setExpeditionPlace("78216"); cfdi.setPaymentForm(facturama.Catalogs().PaymentForms().get(3).getValue()); cfdi.setPaymentMethod("PUE"); cfdi.setCurrency(currency.getValue());
List<Tax> lstTaxes = new ArrayList<>(); Tax tax = new Tax(); tax.setName("IVA"); tax.setIsQuota(false); tax.setIsRetention(false); tax.setRate(0.16); tax.setBase(5550.00); tax.setTotal(888.00); lstTaxes.add(tax); Tax tax2 = new Tax(); tax2.setName("IVA RET"); tax2.setIsQuota(false); tax2.setIsRetention(true); tax2.setRate(0.106667); tax2.setBase(5550.00); tax2.setTotal(592.00); lstTaxes.add(tax2); Tax tax3 = new Tax(); tax3.setName("ISR"); tax3.setIsQuota(false); tax3.setIsRetention(true); tax3.setRate(0.01); tax3.setBase(5550.00); tax3.setTotal(555.00); lstTaxes.add(tax3); item.setTaxes(lstTaxes);
NameId = "3", CfdiType = CfdiType.Ingreso, ExpeditionPlace = "78116", PaymentForm = "03", PaymentMethod = "PUE", Currency = "MXN",
Taxes = new List{ new Tax { Name = "IVA", Rate = 0.00m, Total = 0.00m, Base = 100.00m, IsRetention = false }, new Tax { Name = "IVA RET", Rate = 0.00m, Total = 0.00m, Base = 100.00m, IsRetention = true }, new Tax { Name = "ISR", Rate = 0.1m, Total = 10.00m, Base = 100.00m, IsRetention = true } },
"NameId": "3", "CfdiType": "I", "ExpeditionPlace": "78116", "PaymentForm": "03", "PaymentMethod": "PUE",
"Taxes": [{ "Name": "IVA", "Rate": "0", "Total": "0", "Base": "100", "IsRetention": "false" }, { "Name": "IVA RET", "Rate": "0", "Total": "0", "Base": "100", "IsRetention": "true" }, { "Name": "ISR", "Rate": "0.1", "Total": "10", "Base": "100", "IsRetention": "true" }],
En el caso de que el bien o servicio goce de IVA Exento, lo puedes expresar de la siguiente manera:
"Taxes": [{ "Name": "IVA Exento", "Rate": "0", "Total": "0", "Base": "100", "IsRetention": "false", "IsFederalTax": "true" }]
Se considera impuesto local a cualquier impuesto que no sea de los conocidos (IVA, IVA RET, IEPS, ISR, etc).
Los impuestos locales, pueden llevar cualquier nombre por ejemplo:
Se aplican por ejemplo para: Honorarios por impartir clases; Honorarios por Arrendamiento; Factura relacionada a la construcción, etc.
En general para quien requiera impuestos locales
En la sección de impuestos Taxes, se colocan los nodos necesarios de impuestos locales, tal como se agregaría cualquier otro tipo de impuesto (IVA, IVA RET, etc)
"Taxes": [{ "Name": "IVA", "Rate": "0", "Total": "0", "Base": "100", "IsRetention": "false" }, { "Name": "CEDULAR", "Rate": "0.01", "Total": "55.5", "Base": "5550", "IsRetention": "true", }],
"Taxes" => [{ "Name" => "IVA", "Rate" => "0", "Total" => "0", "Base" => "100", "IsRetention" => "false" }, { "Name" => "CEDULAR", "Rate" => "0.01", "Total" => "55.5", "Base" => "5550", "IsRetention" => "true", }],
"Taxes": [{ "Name": "IVA", "Rate": "0", "Total": "0", "Base": "100", "IsRetention": "false" }, { "Name": "CEDULAR", "Rate": "0.01", "Total": "55.5", "Base": "5550", "IsRetention": "true", }],
List<Tax> lstTaxes = new ArrayList<>(); Tax tax = new Tax(); tax.setName("IVA"); tax.setIsQuota(false); tax.setIsRetention(false); tax.setRate(0.16); tax.setBase(5550.00); tax.setTotal(888.00); lstTaxes.add(tax); Tax localTax = new Tax(); localTax.setName("CEDULAR"); localTax.setIsQuota(false); localTax.setIsRetention(true); localTax.setRate(0.01); localTax.setBase(5550.00); localTax.setTotal(55.50); lstTaxes.add(localTax); item.setTaxes(lstTaxes);
Taxes = new List{ new Tax { Name = "IVA", Rate = 0.00m, Total = 0.00m, Base = 100.00m, IsRetention = false }, new Tax { Name = "CEDULAR", Rate = 0.01m, Total = 55.5m, Base = 5550.00m, IsRetention = true, } },
"Taxes": [{ "Name": "IVA", "Rate": "0", "Total": "0", "Base": "100", "IsRetention": "false" }, { "Name": "CEDULAR", "Rate": "0.01", "Total": "55.5", "Base": "5550", "IsRetention": "true", }],