# Invoice Updates

In this guide, we have added the **Invoice Updates Webhooks** Payload data format for invoice updates, The example shows the **Invoice Update** as **Draft**, however, the payload format is similar for other updates such as **Paid, Pending,** and **Sent.**

## Invoice Updates

**(i) Payload Format:** This is an example of the **Invoice Update** as **Draft** Payload data format and content that Whautomate will transmit to the configured endpoint. All other invoice updates follow similar payload format.

```json
{
  "event": {
    "id": "{{event.id}}",
    "type": "{{event.type}}",
    "timeStamp": "{{event.timeStamp}}",
    "key": "{{event.key}}"
  },
  "invoice": {
    "id": "{{invoice.id}}",
    "location": {
      "id": "{{invoice.location.id}}",
      "title": "{{invoice.location.title}}"
    },
    "client": {
      "id": "{{invoice.client.id}}",
      "fullName": "{{invoice.client.fullName}}",
      "countryCode": "{{invoice.client.countryCode}}",
      "phone": "{{invoice.client.phone}}",
      "email": "{{invoice.client.email}}"
    },
    "staff": {
      "id": "{{invoice.staff.id}}",
      "name": "{{invoice.staff.name}}"
    },
    "dueDate": "{{invoice.dueDate}}",
    "date": "{{invoice.date}}",
    "status": "{{invoice.status}}",
    "invoiceNumber": "{{invoice.invoiceNumber}}",
    "internalNotes": "{{invoice.internalNotes}}",
    "clientNotes": "{{invoice.clientNotes}}",
    "currency": "{{invoice.currency}}",
    "total": "{{invoice.total}}",
    "pendingAmount": "{{invoice.pendingAmount}}",
    "items": "{{invoice.items}}",
    "invoicePDF": "{{invoice.invoicePDF}}",
    "createdAt": "{{invoice.createdAt}}",
    "updatedAt": "{{invoice.updatedAt}}"
  }
}
```

(ii) Invoice Update as Draft test Payload data 👇

```json
{
  "event": {
    "id": "ecKyX3x8IY",
    "type": "invoice_updates",
    "timeStamp": "2024-03-28T10:00:00Z",
    "key": "AZEa1bTPqE"
  },
  "invoice": {
    "id": "AZEa1bTPqE",
    "location": {
      "id": "YFoWQBDuAu",
      "title": "Whautomate"
    },
    "client": {
      "id": "XpSCitpwse",
      "fullName": "John Doe",
      "countryCode": "+65",
      "phone": "98765432",
      "email": "test@example.com"
    },
    "staff": {
      "id": "DCaR2sMN1o",
      "name": "John Doe"
    },
    "items": [
      {
        "itemType": "SERVICE",
        "itemDetails": [
          {
            "itemName": "Consultation",
            "id": "8UYsHz0naJ"
          }
        ],
        "unit": 1,
        "price": 500,
        "taxes": [],
        "discountPrice": 0,
        "discountType": "PERCENTAGE",
        "total": 500
      }
    ],
    "date": "2024-03-25",
    "status": "DRAFT",
    "invoiceNumber": "INV-1001",
    "internalNotes": "Sample Notes for Internal Use",
    "clientNotes": "Thank you for your business.",
    "currency": "SGD",
    "total": "500",
    "pendingAmount": "500",
    "invoicePDF": "https://example.com/inv-1001.pdf",
    "createdAt": "2024-03-28T10:00:00Z",
    "updatedAt": "2024-03-28T11:45:00Z"
  }
}

```
