Ejemplos / Factura (01)
Factura con gravadas, exoneradas e inafectas
Una misma factura con líneas gravadas (10), exoneradas (20) e inafectas (30).
1. Entrada
El comprobante en JSON, tal como está en fixtures/01-invoice-exempt-and-unaffected.json.
{
"kind": "invoice",
"ubl_version": "2.1",
"operation_type": "0101",
"document_type": "01",
"series": "F001",
"number": "4",
"issue_date": "2026-10-15T10:30:00-05:00",
"currency": "PEN",
"payment_terms": {
"type": "Contado"
},
"issuer": {
"ruc": "20123456789",
"legal_name": "EMPRESA DEMO ORACULO S.A.C.",
"trade_name": "DEMO ORACULO",
"email": "facturacion@example.com",
"telephone": "014000000",
"address": {
"ubigeo": "150101",
"country_code": "PE",
"department": "LIMA",
"province": "LIMA",
"district": "LIMA",
"urbanization": "-",
"street": "AV. EJEMPLO 123",
"establishment_code": "0000"
}
},
"customer": {
"document_type": "6",
"document_number": "20000000001",
"legal_name": "CLIENTE DEMO S.A.",
"address": {
"ubigeo": "150122",
"country_code": "PE",
"department": "LIMA",
"province": "LIMA",
"district": "MIRAFLORES",
"street": "CALLE CLIENTE 456"
}
},
"totals": {
"taxed": "100.00",
"exempt": "50.00",
"unaffected": "30.00",
"igv": "18.00",
"total_taxes": "18.00",
"sale_value": "180.00",
"subtotal": "198.00",
"payable": "198.00"
},
"lines": [
{
"unit": "NIU",
"quantity": "1",
"product_code": "GRV001",
"sunat_product_code": "10191509",
"description": "Producto gravado",
"unit_value": "100.00",
"igv_base": "100.00",
"igv_rate": "18.00",
"igv": "18.00",
"affectation": "10",
"total_taxes": "18.00",
"unit_price": "118.00",
"line_value": "100.00"
},
{
"unit": "NIU",
"quantity": "2",
"product_code": "EXO001",
"description": "Libro (exonerado)",
"unit_value": "25.00",
"igv_base": "50.00",
"igv_rate": "18.00",
"igv": "0.00",
"affectation": "20",
"total_taxes": "0.00",
"unit_price": "25.00",
"line_value": "50.00"
},
{
"unit": "NIU",
"quantity": "1",
"product_code": "INA001",
"description": "Servicio inafecto",
"unit_value": "30.00",
"igv_base": "30.00",
"igv_rate": "18.00",
"igv": "0.00",
"affectation": "30",
"total_taxes": "0.00",
"unit_price": "30.00",
"line_value": "30.00"
}
],
"legends": [
{
"code": "1000",
"value": "SON CIENTO NOVENTA Y OCHO CON 00/100 SOLES"
}
]
}
2. XML sin firmar
Mostrar el XML sin firmar (7,602 caracteres)
<?xml version="1.0" encoding="utf-8"?><Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"><ext:UBLExtensions><ext:UBLExtension><ext:ExtensionContent/></ext:UBLExtension></ext:UBLExtensions><cbc:UBLVersionID>2.1</cbc:UBLVersionID><cbc:CustomizationID>2.0</cbc:CustomizationID><cbc:ID>F001-4</cbc:ID><cbc:IssueDate>2026-10-15</cbc:IssueDate><cbc:IssueTime>10:30:00</cbc:IssueTime><cbc:InvoiceTypeCode listID="0101">01</cbc:InvoiceTypeCode><cbc:Note languageLocaleID="1000"><![CDATA[SON CIENTO NOVENTA Y OCHO CON 00/100 SOLES]]></cbc:Note><cbc:DocumentCurrencyCode>PEN</cbc:DocumentCurrencyCode><cac:Signature><cbc:ID>IDSignKG</cbc:ID><cac:SignatoryParty><cac:PartyIdentification><cbc:ID>20123456789</cbc:ID></cac:PartyIdentification><cac:PartyName><cbc:Name><![CDATA[EMPRESA DEMO ORACULO S.A.C.]]></cbc:Name></cac:PartyName></cac:SignatoryParty><cac:DigitalSignatureAttachment><cac:ExternalReference><cbc:URI>#signatureKG</cbc:URI></cac:ExternalReference></cac:DigitalSignatureAttachment></cac:Signature><cac:AccountingSupplierParty><cac:Party><cac:PartyIdentification><cbc:ID schemeID="6">20123456789</cbc:ID></cac:PartyIdentification><cac:PartyName><cbc:Name><![CDATA[DEMO ORACULO]]></cbc:Name></cac:PartyName><cac:PartyLegalEntity><cbc:RegistrationName><![CDATA[EMPRESA DEMO ORACULO S.A.C.]]></cbc:RegistrationName><cac:RegistrationAddress><cbc:ID>150101</cbc:ID><cbc:AddressTypeCode>0000</cbc:AddressTypeCode><cbc:CitySubdivisionName>-</cbc:CitySubdivisionName><cbc:CityName>LIMA</cbc:CityName><cbc:CountrySubentity>LIMA</cbc:CountrySubentity><cbc:District>LIMA</cbc:District><cac:AddressLine><cbc:Line><![CDATA[AV. EJEMPLO 123]]></cbc:Line></cac:AddressLine><cac:Country><cbc:IdentificationCode>PE</cbc:IdentificationCode></cac:Country></cac:RegistrationAddress></cac:PartyLegalEntity><cac:Contact><cbc:Telephone>014000000</cbc:Telephone><cbc:ElectronicMail>facturacion@example.com</cbc:ElectronicMail></cac:Contact></cac:Party></cac:AccountingSupplierParty><cac:AccountingCustomerParty><cac:Party><cac:PartyIdentification><cbc:ID schemeID="6">20000000001</cbc:ID></cac:PartyIdentification><cac:PartyLegalEntity><cbc:RegistrationName><![CDATA[CLIENTE DEMO S.A.]]></cbc:RegistrationName><cac:RegistrationAddress><cbc:ID>150122</cbc:ID><cac:AddressLine><cbc:Line><![CDATA[CALLE CLIENTE 456]]></cbc:Line></cac:AddressLine><cac:Country><cbc:IdentificationCode>PE</cbc:IdentificationCode></cac:Country></cac:RegistrationAddress></cac:PartyLegalEntity></cac:Party></cac:AccountingCustomerParty><cac:PaymentTerms><cbc:ID>FormaPago</cbc:ID><cbc:PaymentMeansID>Contado</cbc:PaymentMeansID></cac:PaymentTerms><cac:TaxTotal><cbc:TaxAmount currencyID="PEN">18.00</cbc:TaxAmount><cac:TaxSubtotal><cbc:TaxableAmount currencyID="PEN">100.00</cbc:TaxableAmount><cbc:TaxAmount currencyID="PEN">18.00</cbc:TaxAmount><cac:TaxCategory><cac:TaxScheme><cbc:ID>1000</cbc:ID><cbc:Name>IGV</cbc:Name><cbc:TaxTypeCode>VAT</cbc:TaxTypeCode></cac:TaxScheme></cac:TaxCategory></cac:TaxSubtotal><cac:TaxSubtotal><cbc:TaxableAmount currencyID="PEN">30.00</cbc:TaxableAmount><cbc:TaxAmount currencyID="PEN">0.00</cbc:TaxAmount><cac:TaxCategory><cac:TaxScheme><cbc:ID>9998</cbc:ID><cbc:Name>INA</cbc:Name><cbc:TaxTypeCode>FRE</cbc:TaxTypeCode></cac:TaxScheme></cac:TaxCategory></cac:TaxSubtotal><cac:TaxSubtotal><cbc:TaxableAmount currencyID="PEN">50.00</cbc:TaxableAmount><cbc:TaxAmount currencyID="PEN">0.00</cbc:TaxAmount><cac:TaxCategory><cac:TaxScheme><cbc:ID>9997</cbc:ID><cbc:Name>EXO</cbc:Name><cbc:TaxTypeCode>VAT</cbc:TaxTypeCode></cac:TaxScheme></cac:TaxCategory></cac:TaxSubtotal></cac:TaxTotal><cac:LegalMonetaryTotal><cbc:LineExtensionAmount currencyID="PEN">180.00</cbc:LineExtensionAmount><cbc:TaxInclusiveAmount currencyID="PEN">198.00</cbc:TaxInclusiveAmount><cbc:PayableAmount currencyID="PEN">198.00</cbc:PayableAmount></cac:LegalMonetaryTotal><cac:InvoiceLine><cbc:ID>1</cbc:ID><cbc:InvoicedQuantity unitCode="NIU">1</cbc:InvoicedQuantity><cbc:LineExtensionAmount currencyID="PEN">100.00</cbc:LineExtensionAmount><cac:PricingReference><cac:AlternativeConditionPrice><cbc:PriceAmount currencyID="PEN">118</cbc:PriceAmount><cbc:PriceTypeCode>01</cbc:PriceTypeCode></cac:AlternativeConditionPrice></cac:PricingReference><cac:TaxTotal><cbc:TaxAmount currencyID="PEN">18.00</cbc:TaxAmount><cac:TaxSubtotal><cbc:TaxableAmount currencyID="PEN">100.00</cbc:TaxableAmount><cbc:TaxAmount currencyID="PEN">18.00</cbc:TaxAmount><cac:TaxCategory><cbc:Percent>18</cbc:Percent><cbc:TaxExemptionReasonCode>10</cbc:TaxExemptionReasonCode><cac:TaxScheme><cbc:ID>1000</cbc:ID><cbc:Name>IGV</cbc:Name><cbc:TaxTypeCode>VAT</cbc:TaxTypeCode></cac:TaxScheme></cac:TaxCategory></cac:TaxSubtotal></cac:TaxTotal><cac:Item><cbc:Description><![CDATA[Producto gravado]]></cbc:Description><cac:SellersItemIdentification><cbc:ID>GRV001</cbc:ID></cac:SellersItemIdentification><cac:CommodityClassification><cbc:ItemClassificationCode>10191509</cbc:ItemClassificationCode></cac:CommodityClassification></cac:Item><cac:Price><cbc:PriceAmount currencyID="PEN">100</cbc:PriceAmount></cac:Price></cac:InvoiceLine><cac:InvoiceLine><cbc:ID>2</cbc:ID><cbc:InvoicedQuantity unitCode="NIU">2</cbc:InvoicedQuantity><cbc:LineExtensionAmount currencyID="PEN">50.00</cbc:LineExtensionAmount><cac:PricingReference><cac:AlternativeConditionPrice><cbc:PriceAmount currencyID="PEN">25</cbc:PriceAmount><cbc:PriceTypeCode>01</cbc:PriceTypeCode></cac:AlternativeConditionPrice></cac:PricingReference><cac:TaxTotal><cbc:TaxAmount currencyID="PEN">0.00</cbc:TaxAmount><cac:TaxSubtotal><cbc:TaxableAmount currencyID="PEN">50.00</cbc:TaxableAmount><cbc:TaxAmount currencyID="PEN">0.00</cbc:TaxAmount><cac:TaxCategory><cbc:Percent>18</cbc:Percent><cbc:TaxExemptionReasonCode>20</cbc:TaxExemptionReasonCode><cac:TaxScheme><cbc:ID>9997</cbc:ID><cbc:Name>EXO</cbc:Name><cbc:TaxTypeCode>VAT</cbc:TaxTypeCode></cac:TaxScheme></cac:TaxCategory></cac:TaxSubtotal></cac:TaxTotal><cac:Item><cbc:Description><![CDATA[Libro (exonerado)]]></cbc:Description><cac:SellersItemIdentification><cbc:ID>EXO001</cbc:ID></cac:SellersItemIdentification></cac:Item><cac:Price><cbc:PriceAmount currencyID="PEN">25</cbc:PriceAmount></cac:Price></cac:InvoiceLine><cac:InvoiceLine><cbc:ID>3</cbc:ID><cbc:InvoicedQuantity unitCode="NIU">1</cbc:InvoicedQuantity><cbc:LineExtensionAmount currencyID="PEN">30.00</cbc:LineExtensionAmount><cac:PricingReference><cac:AlternativeConditionPrice><cbc:PriceAmount currencyID="PEN">30</cbc:PriceAmount><cbc:PriceTypeCode>01</cbc:PriceTypeCode></cac:AlternativeConditionPrice></cac:PricingReference><cac:TaxTotal><cbc:TaxAmount currencyID="PEN">0.00</cbc:TaxAmount><cac:TaxSubtotal><cbc:TaxableAmount currencyID="PEN">30.00</cbc:TaxableAmount><cbc:TaxAmount currencyID="PEN">0.00</cbc:TaxAmount><cac:TaxCategory><cbc:Percent>18</cbc:Percent><cbc:TaxExemptionReasonCode>30</cbc:TaxExemptionReasonCode><cac:TaxScheme><cbc:ID>9998</cbc:ID><cbc:Name>INA</cbc:Name><cbc:TaxTypeCode>FRE</cbc:TaxTypeCode></cac:TaxScheme></cac:TaxCategory></cac:TaxSubtotal></cac:TaxTotal><cac:Item><cbc:Description><![CDATA[Servicio inafecto]]></cbc:Description><cac:SellersItemIdentification><cbc:ID>INA001</cbc:ID></cac:SellersItemIdentification></cac:Item><cac:Price><cbc:PriceAmount currencyID="PEN">30</cbc:PriceAmount></cac:Price></cac:InvoiceLine></Invoice>3. Firma
Firmado con el certificado de prueba del repositorio, tests/vectors/test-cert/. No es un certificado de contribuyente.
- DigestValue
KHcOsiT6iUbgujmHUPpc1eDrsCs=- SignatureValue
tfOHF1SgUDod2LOt6oeIFQMcEMjXJMZvkoJQ/behnN4DM0E/UTb23tUUim/H/OEEf/CRp84aAeYcj22BabdOOZV4SX1Yg5Azx4r2F7onOOBshVHAvO13O20Aj07AsCrTnxNaYsucGo76311Mafu+A3Q6c9rsyU/8WeZnzzYHOJCX3WyQU2E7waXFjo4tB/XplvvwPqG+h2jHncUuz+b8C9TUgRkkTxFA1of4CbHzLUPAL2aR10f3rYhmVD2WewK548xXVNL+5HfpIKcS+7HbnbzoT7zrZ8/lhPtbATkH3CsU8B22VnKm3IkTAythCKPbgqaQgt4McRFlBW1fwAUqgQ==
Mostrar el XML firmado
<?xml version="1.0" encoding="utf-8"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"><ext:UBLExtensions><ext:UBLExtension><ext:ExtensionContent><ds:Signature Id="signatureKG"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/><ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/><ds:Reference URI=""><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><ds:DigestValue>KHcOsiT6iUbgujmHUPpc1eDrsCs=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>tfOHF1SgUDod2LOt6oeIFQMcEMjXJMZvkoJQ/behnN4DM0E/UTb23tUUim/H/OEEf/CRp84aAeYcj22BabdOOZV4SX1Yg5Azx4r2F7onOOBshVHAvO13O20Aj07AsCrTnxNaYsucGo76311Mafu+A3Q6c9rsyU/8WeZnzzYHOJCX3WyQU2E7waXFjo4tB/XplvvwPqG+h2jHncUuz+b8C9TUgRkkTxFA1of4CbHzLUPAL2aR10f3rYhmVD2WewK548xXVNL+5HfpIKcS+7HbnbzoT7zrZ8/lhPtbATkH3CsU8B22VnKm3IkTAythCKPbgqaQgt4McRFlBW1fwAUqgQ==</ds:SignatureValue><ds:KeyInfo><ds:X509Data><ds:X509Certificate>MIID8zCCAtugAwIBAgIUY968iRS4gHDjt9RwTaDaujmFLO0wDQYJKoZIhvcNAQELBQAwgYgxCzAJBgNVBAYTAlBFMS8wLQYDVQQKDCZURVNUIE9OTFkgLSBOT1QgVkFMSUQgRk9SIEFOWSBUQVhQQVlFUjESMBAGA1UECwwJVEVTVCBPTkxZMRQwEgYDVQQFEwsyMDAwMDAwMDAwMTEeMBwGA1UEAwwVVEVTVCBPTkxZIDIwMDAwMDAwMDAxMB4XDTI2MTAxNTIxMjc0NVoXDTM2MTAxMjIxMjc0NVowgYgxCzAJBgNVBAYTAlBFMS8wLQYDVQQKDCZURVNUIE9OTFkgLSBOT1QgVkFMSUQgRk9SIEFOWSBUQVhQQVlFUjESMBAGA1UECwwJVEVTVCBPTkxZMRQwEgYDVQQFEwsyMDAwMDAwMDAwMTEeMBwGA1UEAwwVVEVTVCBPTkxZIDIwMDAwMDAwMDAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6GZTtpFyih4C6ETakE6Q4+SFBFWJ/TQi2pbxJRD7GkQ1tKeB+ENcBk8EjnOocxdYWvSBpOd9UYkpc2C+jlbVWd04ey8psznwCHzJJ1+qgQqVI8PpH5A4eEw5LGXupHmnJSYpGXFGIJ6+tlJRqvZbq7RTh7Rpxs4DkCjUhUke/BKIZahYDzSGFLlsWx01Dq8Xeb6xF2sLlZXy/b0MvRZAe7I/xplIftS/rrDQ/rE5DfS0Dibayc/uNIRw1+NiKpT0wwY/VCzRQrM27dG7sTyhNAy6C3vtRmO5Bl9+0wrXldZcR4VSm1yrg65KRWv6DNcG2MkxRYBphaM+sJfkNECs6wIDAQABo1MwUTAdBgNVHQ4EFgQUE359gu7BEXWLRhx+VNBeec2Pp/kwHwYDVR0jBBgwFoAUE359gu7BEXWLRhx+VNBeec2Pp/kwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAzjWgukifoL9gZckM2jWW7a+N6+5W/0EkGJVFV9RbCceNpDpdMyVD4QyVm1nOJ/bQzOLdDnjyD3J34/1pEwo/hS/HehPy50twvf/uKEwPU4TNQTyjChnM3k+IX7cOusuPIBsC6trufeHOSky5lWiKWusMHo8VsPvVinE0n/RqTo47enHPFa6huF3egiQEJ6H+lxerXvWT8IkaGFA2YKjAGGsenlCSw9rRGX4tzQtUkJx0oFaEZGNpq+OYr334J3cZp9LskUFnrvRoAz3Fk8HdbVlfQTovFunFY9VzxbKjBfyWa6hymTxcvBR9x4ZfUKM9P3REeBKaTWdqe2oz4d6LLA==</ds:X509Certificate></ds:X509Data></ds:KeyInfo></ds:Signature></ext:ExtensionContent></ext:UBLExtension></ext:UBLExtensions><cbc:UBLVersionID>2.1</cbc:UBLVersionID><cbc:CustomizationID>2.0</cbc:CustomizationID><cbc:ID>F001-4</cbc:ID><cbc:IssueDate>2026-10-15</cbc:IssueDate><cbc:IssueTime>10:30:00</cbc:IssueTime><cbc:InvoiceTypeCode listID="0101">01</cbc:InvoiceTypeCode><cbc:Note languageLocaleID="1000"><![CDATA[SON CIENTO NOVENTA Y OCHO CON 00/100 SOLES]]></cbc:Note><cbc:DocumentCurrencyCode>PEN</cbc:DocumentCurrencyCode><cac:Signature><cbc:ID>IDSignKG</cbc:ID><cac:SignatoryParty><cac:PartyIdentification><cbc:ID>20123456789</cbc:ID></cac:PartyIdentification><cac:PartyName><cbc:Name><![CDATA[EMPRESA DEMO ORACULO S.A.C.]]></cbc:Name></cac:PartyName></cac:SignatoryParty><cac:DigitalSignatureAttachment><cac:ExternalReference><cbc:URI>#signatureKG</cbc:URI></cac:ExternalReference></cac:DigitalSignatureAttachment></cac:Signature><cac:AccountingSupplierParty><cac:Party><cac:PartyIdentification><cbc:ID schemeID="6">20123456789</cbc:ID></cac:PartyIdentification><cac:PartyName><cbc:Name><![CDATA[DEMO ORACULO]]></cbc:Name></cac:PartyName><cac:PartyLegalEntity><cbc:RegistrationName><![CDATA[EMPRESA DEMO ORACULO S.A.C.]]></cbc:RegistrationName><cac:RegistrationAddress><cbc:ID>150101</cbc:ID><cbc:AddressTypeCode>0000</cbc:AddressTypeCode><cbc:CitySubdivisionName>-</cbc:CitySubdivisionName><cbc:CityName>LIMA</cbc:CityName><cbc:CountrySubentity>LIMA</cbc:CountrySubentity><cbc:District>LIMA</cbc:District><cac:AddressLine><cbc:Line><![CDATA[AV. EJEMPLO 123]]></cbc:Line></cac:AddressLine><cac:Country><cbc:IdentificationCode>PE</cbc:IdentificationCode></cac:Country></cac:RegistrationAddress></cac:PartyLegalEntity><cac:Contact><cbc:Telephone>014000000</cbc:Telephone><cbc:ElectronicMail>facturacion@example.com</cbc:ElectronicMail></cac:Contact></cac:Party></cac:AccountingSupplierParty><cac:AccountingCustomerParty><cac:Party><cac:PartyIdentification><cbc:ID schemeID="6">20000000001</cbc:ID></cac:PartyIdentification><cac:PartyLegalEntity><cbc:RegistrationName><![CDATA[CLIENTE DEMO S.A.]]></cbc:RegistrationName><cac:RegistrationAddress><cbc:ID>150122</cbc:ID><cac:AddressLine><cbc:Line><![CDATA[CALLE CLIENTE 456]]></cbc:Line></cac:AddressLine><cac:Country><cbc:IdentificationCode>PE</cbc:IdentificationCode></cac:Country></cac:RegistrationAddress></cac:PartyLegalEntity></cac:Party></cac:AccountingCustomerParty><cac:PaymentTerms><cbc:ID>FormaPago</cbc:ID><cbc:PaymentMeansID>Contado</cbc:PaymentMeansID></cac:PaymentTerms><cac:TaxTotal><cbc:TaxAmount currencyID="PEN">18.00</cbc:TaxAmount><cac:TaxSubtotal><cbc:TaxableAmount currencyID="PEN">100.00</cbc:TaxableAmount><cbc:TaxAmount currencyID="PEN">18.00</cbc:TaxAmount><cac:TaxCategory><cac:TaxScheme><cbc:ID>1000</cbc:ID><cbc:Name>IGV</cbc:Name><cbc:TaxTypeCode>VAT</cbc:TaxTypeCode></cac:TaxScheme></cac:TaxCategory></cac:TaxSubtotal><cac:TaxSubtotal><cbc:TaxableAmount currencyID="PEN">30.00</cbc:TaxableAmount><cbc:TaxAmount currencyID="PEN">0.00</cbc:TaxAmount><cac:TaxCategory><cac:TaxScheme><cbc:ID>9998</cbc:ID><cbc:Name>INA</cbc:Name><cbc:TaxTypeCode>FRE</cbc:TaxTypeCode></cac:TaxScheme></cac:TaxCategory></cac:TaxSubtotal><cac:TaxSubtotal><cbc:TaxableAmount currencyID="PEN">50.00</cbc:TaxableAmount><cbc:TaxAmount currencyID="PEN">0.00</cbc:TaxAmount><cac:TaxCategory><cac:TaxScheme><cbc:ID>9997</cbc:ID><cbc:Name>EXO</cbc:Name><cbc:TaxTypeCode>VAT</cbc:TaxTypeCode></cac:TaxScheme></cac:TaxCategory></cac:TaxSubtotal></cac:TaxTotal><cac:LegalMonetaryTotal><cbc:LineExtensionAmount currencyID="PEN">180.00</cbc:LineExtensionAmount><cbc:TaxInclusiveAmount currencyID="PEN">198.00</cbc:TaxInclusiveAmount><cbc:PayableAmount currencyID="PEN">198.00</cbc:PayableAmount></cac:LegalMonetaryTotal><cac:InvoiceLine><cbc:ID>1</cbc:ID><cbc:InvoicedQuantity unitCode="NIU">1</cbc:InvoicedQuantity><cbc:LineExtensionAmount currencyID="PEN">100.00</cbc:LineExtensionAmount><cac:PricingReference><cac:AlternativeConditionPrice><cbc:PriceAmount currencyID="PEN">118</cbc:PriceAmount><cbc:PriceTypeCode>01</cbc:PriceTypeCode></cac:AlternativeConditionPrice></cac:PricingReference><cac:TaxTotal><cbc:TaxAmount currencyID="PEN">18.00</cbc:TaxAmount><cac:TaxSubtotal><cbc:TaxableAmount currencyID="PEN">100.00</cbc:TaxableAmount><cbc:TaxAmount currencyID="PEN">18.00</cbc:TaxAmount><cac:TaxCategory><cbc:Percent>18</cbc:Percent><cbc:TaxExemptionReasonCode>10</cbc:TaxExemptionReasonCode><cac:TaxScheme><cbc:ID>1000</cbc:ID><cbc:Name>IGV</cbc:Name><cbc:TaxTypeCode>VAT</cbc:TaxTypeCode></cac:TaxScheme></cac:TaxCategory></cac:TaxSubtotal></cac:TaxTotal><cac:Item><cbc:Description><![CDATA[Producto gravado]]></cbc:Description><cac:SellersItemIdentification><cbc:ID>GRV001</cbc:ID></cac:SellersItemIdentification><cac:CommodityClassification><cbc:ItemClassificationCode>10191509</cbc:ItemClassificationCode></cac:CommodityClassification></cac:Item><cac:Price><cbc:PriceAmount currencyID="PEN">100</cbc:PriceAmount></cac:Price></cac:InvoiceLine><cac:InvoiceLine><cbc:ID>2</cbc:ID><cbc:InvoicedQuantity unitCode="NIU">2</cbc:InvoicedQuantity><cbc:LineExtensionAmount currencyID="PEN">50.00</cbc:LineExtensionAmount><cac:PricingReference><cac:AlternativeConditionPrice><cbc:PriceAmount currencyID="PEN">25</cbc:PriceAmount><cbc:PriceTypeCode>01</cbc:PriceTypeCode></cac:AlternativeConditionPrice></cac:PricingReference><cac:TaxTotal><cbc:TaxAmount currencyID="PEN">0.00</cbc:TaxAmount><cac:TaxSubtotal><cbc:TaxableAmount currencyID="PEN">50.00</cbc:TaxableAmount><cbc:TaxAmount currencyID="PEN">0.00</cbc:TaxAmount><cac:TaxCategory><cbc:Percent>18</cbc:Percent><cbc:TaxExemptionReasonCode>20</cbc:TaxExemptionReasonCode><cac:TaxScheme><cbc:ID>9997</cbc:ID><cbc:Name>EXO</cbc:Name><cbc:TaxTypeCode>VAT</cbc:TaxTypeCode></cac:TaxScheme></cac:TaxCategory></cac:TaxSubtotal></cac:TaxTotal><cac:Item><cbc:Description><![CDATA[Libro (exonerado)]]></cbc:Description><cac:SellersItemIdentification><cbc:ID>EXO001</cbc:ID></cac:SellersItemIdentification></cac:Item><cac:Price><cbc:PriceAmount currencyID="PEN">25</cbc:PriceAmount></cac:Price></cac:InvoiceLine><cac:InvoiceLine><cbc:ID>3</cbc:ID><cbc:InvoicedQuantity unitCode="NIU">1</cbc:InvoicedQuantity><cbc:LineExtensionAmount currencyID="PEN">30.00</cbc:LineExtensionAmount><cac:PricingReference><cac:AlternativeConditionPrice><cbc:PriceAmount currencyID="PEN">30</cbc:PriceAmount><cbc:PriceTypeCode>01</cbc:PriceTypeCode></cac:AlternativeConditionPrice></cac:PricingReference><cac:TaxTotal><cbc:TaxAmount currencyID="PEN">0.00</cbc:TaxAmount><cac:TaxSubtotal><cbc:TaxableAmount currencyID="PEN">30.00</cbc:TaxableAmount><cbc:TaxAmount currencyID="PEN">0.00</cbc:TaxAmount><cac:TaxCategory><cbc:Percent>18</cbc:Percent><cbc:TaxExemptionReasonCode>30</cbc:TaxExemptionReasonCode><cac:TaxScheme><cbc:ID>9998</cbc:ID><cbc:Name>INA</cbc:Name><cbc:TaxTypeCode>FRE</cbc:TaxTypeCode></cac:TaxScheme></cac:TaxCategory></cac:TaxSubtotal></cac:TaxTotal><cac:Item><cbc:Description><![CDATA[Servicio inafecto]]></cbc:Description><cac:SellersItemIdentification><cbc:ID>INA001</cbc:ID></cac:SellersItemIdentification></cac:Item><cac:Price><cbc:PriceAmount currencyID="PEN">30</cbc:PriceAmount></cac:Price></cac:InvoiceLine></Invoice>
Reproducirlo con el binario
sunat-sdk build < fixtures/01-invoice-exempt-and-unaffected.json
# {"file_name": "...", "xml": "<XML sin firmar>"}
sunat-sdk sign --cert tests/vectors/test-cert/test-cert.pem --key tests/vectors/test-cert/test-key.pem < firma.json
# firma.json: {"xml": "<XML sin firmar de la salida anterior>"}Los pasos completos, con los entornos y las credenciales, están en la guía de inicio.