Prerequisites
Before starting, ensure you have:- Open Factura installed in your project
- A valid .p12 digital certificate from Security Data or Banco Central
- SRI reception and authorization endpoint URLs
- Your company’s tax information (RUC, business name, etc.)
Step-by-step guide
Create invoice data
Build your invoice data structure with type safety. Here’s a basic example:The
generateInvoice function returns both the invoice object and the auto-generated access key.Load and sign with certificate
Load your .p12 certificate and sign the XML document:
Open Factura supports certificates from both Security Data and Banco Central providers.
Complete example
Here’s a full working example putting it all together:complete-example.ts
Environment variables
Create a.env file with your configuration:
.env
Next steps
Complete workflow
See the end-to-end invoice workflow
Type definitions
Explore all available types
Document signing
Learn about digital signatures
SRI integration
Understand SRI endpoints