From 2561bfdf5a06505efdbf8a9a0f58f48100d81e59 Mon Sep 17 00:00:00 2001 From: Rob Pocklington Date: Tue, 2 Dec 2025 12:12:57 +1100 Subject: [PATCH] feat: add example for credit note webhooks and update schema --- xero-webhooks.yaml | 117 +++++++++++++++++++++++++++++---------------- 1 file changed, 75 insertions(+), 42 deletions(-) diff --git a/xero-webhooks.yaml b/xero-webhooks.yaml index af598efe9..77eb09325 100644 --- a/xero-webhooks.yaml +++ b/xero-webhooks.yaml @@ -76,6 +76,24 @@ webhooks: application/json: schema: $ref: "#/components/schemas/CreditNoteWebhookEvent" + examples: + creditNoteCreate: + summary: Credit Note Create Event + value: + events: + - resourceUrl: https://api.xero.com/api.xro/2.0/CreditNotes/55d84274-a3da-4829-a7c0-0cab601b95cc + resourceId: 55d84274-a3da-4829-a7c0-0cab601b95cc + tenantId: aef86862-2015-4b6b-88bc-d89032cecc50 + tenantType: ORGANISATION + eventCategory: CREDITNOTE + eventType: CREATE + eventDateUtc: 2025-12-02T00:44:09.923 + data: + Type: ACCPAYCREDIT + Status: DRAFT + firstEventSequence: 76 + lastEventSequence: 76 + entropy: FXNGWLCCGVANWHKILRUB responses: "200": $ref: "#/components/responses/200WebhookDataReceivedOk" @@ -138,6 +156,9 @@ components: - type: string const: SUBSCRIPTION description: For application subscription-related events + - type: string + const: CREDITNOTE + description: For organisation credit note-related events tenantId: type: string format: uuid @@ -179,48 +200,60 @@ components: - $ref: "#/components/schemas/WebhookEvent" - type: object properties: - data: - type: object - required: - - Type - - Status - properties: - Type: - type: string - description: The type of credit note - externalDocs: - url: https://developer.xero.com/documentation/api/accounting/types#credit-notes - oneOf: - - type: string - const: ACCPAYCREDIT - description: An Accounts Payable(supplier) Credit Note - - type: string - const: ACCRECCREDIT - description: An Account Receivable(customer) Credit Note - Status: - type: string - description: The status of the credit note - externalDocs: - url: https://developer.xero.com/documentation/api/accounting/types#invoice-status-codes - oneOf: - - type: string - const: DRAFT - description: Draft credit note - - type: string - const: SUBMITTED - description: Submitted credit note - - type: string - const: DELETED - description: Deleted credit note - - type: string - const: AUTHORISED - description: Authorised credit note - - type: string - const: PAID - description: Paid credit note - - type: string - const: VOIDED - description: Voided credit note + events: + type: array + items: + allOf: + - $ref: "#/components/schemas/WebhookEvent/properties/events/items" + - type: object + properties: + eventCategory: + const: CREDITNOTE + data: + type: object + description: Additional data for credit note events + required: + - Type + - Status + properties: + Type: + type: string + description: The type of credit note + externalDocs: + url: https://developer.xero.com/documentation/api/accounting/types#credit-notes + oneOf: + - type: string + const: ACCPAYCREDIT + description: An Accounts Payable(supplier) Credit Note + - type: string + const: ACCRECCREDIT + description: An Account Receivable(customer) Credit Note + Status: + type: string + description: The status of the credit note + externalDocs: + url: https://developer.xero.com/documentation/api/accounting/types#invoice-status-codes + oneOf: + - type: string + const: DRAFT + description: Draft credit note + - type: string + const: SUBMITTED + description: Submitted credit note + - type: string + const: DELETED + description: Deleted credit note + - type: string + const: AUTHORISED + description: Authorised credit note + - type: string + const: PAID + description: Paid credit note + - type: string + const: VOIDED + description: Voided credit note + required: + - data responses: 401InvalidWebhookData: description: Return a 401 status to indicate that the webhook subscription failed