<!-- Canonical: https://www.ezdis.net/en/manual/1.0/guides/declare-nubefact | Language: en -->

# Declare documents with Nubefact (Peru)

This guide shows how to issue an electronic invoice for Peruvian stores and an electronic receipt for end consumers, using the Nubefact integration.

> **Prerequisite:** Nubefact must be configured and enabled in **Configuration → Invoicing**. See [Nubefact configuration](/en/manual/1.0/config/nubefact).

---

## Issue an electronic invoice (store with RUC — B2B)

For distribution sales to supermarkets, stores and other businesses.

### Required store data

- **RUC** (11 digits) in the store's RUT/RUC profile field.
- Full legal name.

### Steps

1. Open the store's **invoice** (menu **Invoicing → Invoices**).
2. Verify the type is **Factura (Peru)** and the invoice has product lines.
3. Check that amounts and quantities are correct.
4. Click **Declare to SUNAT**.
5. Confirm the issue date and click **Confirm**.

When SUNAT accepts the document:
- Status changes to **Declared**.
- The official PDF with QR code and the XML are available for download.

---

## Issue an electronic receipt (end consumer — B2C)

For direct sales to end consumers at the delivery point.

### Required client data

- **DNI** (8 digits) in the client profile (optional for low amounts).

### Steps

1. Open the invoice linked to a client (individual person).
2. Verify the type is **Boleta (Peru)**.
3. Click **Declare to SUNAT** and confirm.

---

## Credit and debit notes

Require the original invoice or receipt to be already declared to SUNAT.

1. Open the credit or debit note.
2. Verify the referenced invoice has **Declared** status.
3. Click **Declare to SUNAT** and confirm.

---

## Common errors and solutions

| Error | Likely cause | Solution |
|---|---|---|
| `Invalid token` | Incorrect or expired Nubefact token | Check in **Configuration → Invoicing** |
| `Incorrect URL` | URL missing the Nubefact account UUID | Verify the URL includes the unique identifier |
| `Document already exists` | Document already sent to SUNAT | Do not re-declare already accepted documents |
| `Missing recipient data` | Store without RUC or client without DNI | Complete the document in the profile |
| `Invoice already declared` | Attempt to declare twice | No need to declare again |
| `Original invoice must be declared` | Credit/debit note on undeclared invoice | Declare the original document first |
