# Purchase invoice events

Two events tell you when a purchase invoice is stored. Use the event type to decide whether to process the invoice or send it for review.

These events describe purchase documents, such as supplier invoices received through Peppol, the network used to exchange electronic invoices. Invoices you submit through the Unify API as the seller do not raise them.

| Event | Fires when |
| - | - |
| `purchase.invoice.stored` | The invoice was stored successfully. This includes invoices stored with warnings. |
| `purchase.invoice.validation_failed` | The invoice failed validation. It is still stored, so you can see it in Documents, but it needs attention. |

Read the fields below from `data.data` in the [delivery body](https://docs.complyance.io/one-platform/developer-portal/webhooks/payload-and-delivery/#body). Fields such as supplier name, issue date and totals may be absent if they are unavailable.

| Field | Meaning |
| - | - |
| `documentId` | The document’s ID in Complyance. Use it to open the document or fetch it through the [Purchases API](https://docs.complyance.io/api-reference/purchases/). |
| `documentNumber` | The supplier’s invoice number |
| `documentType` | For example `tax_invoice` or `credit_note` |
| `country` | `AE`, `SA`, `MY`, `BE` or `DE` |
| `totalAmount` | The invoice total including tax |
| `currency` | ISO 4217 code, for example `AED` |
| `sellerName` | The supplier |
| `issueDate` | The date on the invoice |
| `submittedAt` | When the invoice entered Complyance |
| `errors` | Validation errors, when available: each has `code`, `message` and an optional `path` |
| `attribution` | Company, branch and source details, when available |
| `attribution.companyId` | The company the purchase belongs to. Use it to select the company in your integration. |
| `attribution.branchId` | The branch, when identified. Do not assume every event includes it. |

## What to do with them

- **stored**: create the invoice in your accounts-payable system, or start your approval flow.
- **validation_failed**: route the invoice to someone for review. Open it in [Documents](https://docs.complyance.io/one-platform/invoice-portal/documents/purchases/) to see the errors in full.

These events are only for invoices you **receive**. Sales invoices you send to customers do not raise these purchase events.

To register for them, see [Set up a webhook](https://docs.complyance.io/one-platform/developer-portal/webhooks/setup/).

Source: https://docs.complyance.io/one-platform/developer-portal/webhooks/purchase-invoices/
