Skip to content

Commit 018baf9

Browse files
authored
Merge pull request #782 from rpocklin/webhooks-update-credit-notes
feat: add example for credit note webhooks and update schema
2 parents debf191 + 2561bfd commit 018baf9

File tree

1 file changed

+75
-42
lines changed

1 file changed

+75
-42
lines changed

xero-webhooks.yaml

Lines changed: 75 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,24 @@ webhooks:
7676
application/json:
7777
schema:
7878
$ref: "#/components/schemas/CreditNoteWebhookEvent"
79+
examples:
80+
creditNoteCreate:
81+
summary: Credit Note Create Event
82+
value:
83+
events:
84+
- resourceUrl: https://api.xero.com/api.xro/2.0/CreditNotes/55d84274-a3da-4829-a7c0-0cab601b95cc
85+
resourceId: 55d84274-a3da-4829-a7c0-0cab601b95cc
86+
tenantId: aef86862-2015-4b6b-88bc-d89032cecc50
87+
tenantType: ORGANISATION
88+
eventCategory: CREDITNOTE
89+
eventType: CREATE
90+
eventDateUtc: 2025-12-02T00:44:09.923
91+
data:
92+
Type: ACCPAYCREDIT
93+
Status: DRAFT
94+
firstEventSequence: 76
95+
lastEventSequence: 76
96+
entropy: FXNGWLCCGVANWHKILRUB
7997
responses:
8098
"200":
8199
$ref: "#/components/responses/200WebhookDataReceivedOk"
@@ -138,6 +156,9 @@ components:
138156
- type: string
139157
const: SUBSCRIPTION
140158
description: For application subscription-related events
159+
- type: string
160+
const: CREDITNOTE
161+
description: For organisation credit note-related events
141162
tenantId:
142163
type: string
143164
format: uuid
@@ -179,48 +200,60 @@ components:
179200
- $ref: "#/components/schemas/WebhookEvent"
180201
- type: object
181202
properties:
182-
data:
183-
type: object
184-
required:
185-
- Type
186-
- Status
187-
properties:
188-
Type:
189-
type: string
190-
description: The type of credit note
191-
externalDocs:
192-
url: https://developer.xero.com/documentation/api/accounting/types#credit-notes
193-
oneOf:
194-
- type: string
195-
const: ACCPAYCREDIT
196-
description: An Accounts Payable(supplier) Credit Note
197-
- type: string
198-
const: ACCRECCREDIT
199-
description: An Account Receivable(customer) Credit Note
200-
Status:
201-
type: string
202-
description: The status of the credit note
203-
externalDocs:
204-
url: https://developer.xero.com/documentation/api/accounting/types#invoice-status-codes
205-
oneOf:
206-
- type: string
207-
const: DRAFT
208-
description: Draft credit note
209-
- type: string
210-
const: SUBMITTED
211-
description: Submitted credit note
212-
- type: string
213-
const: DELETED
214-
description: Deleted credit note
215-
- type: string
216-
const: AUTHORISED
217-
description: Authorised credit note
218-
- type: string
219-
const: PAID
220-
description: Paid credit note
221-
- type: string
222-
const: VOIDED
223-
description: Voided credit note
203+
events:
204+
type: array
205+
items:
206+
allOf:
207+
- $ref: "#/components/schemas/WebhookEvent/properties/events/items"
208+
- type: object
209+
properties:
210+
eventCategory:
211+
const: CREDITNOTE
212+
data:
213+
type: object
214+
description: Additional data for credit note events
215+
required:
216+
- Type
217+
- Status
218+
properties:
219+
Type:
220+
type: string
221+
description: The type of credit note
222+
externalDocs:
223+
url: https://developer.xero.com/documentation/api/accounting/types#credit-notes
224+
oneOf:
225+
- type: string
226+
const: ACCPAYCREDIT
227+
description: An Accounts Payable(supplier) Credit Note
228+
- type: string
229+
const: ACCRECCREDIT
230+
description: An Account Receivable(customer) Credit Note
231+
Status:
232+
type: string
233+
description: The status of the credit note
234+
externalDocs:
235+
url: https://developer.xero.com/documentation/api/accounting/types#invoice-status-codes
236+
oneOf:
237+
- type: string
238+
const: DRAFT
239+
description: Draft credit note
240+
- type: string
241+
const: SUBMITTED
242+
description: Submitted credit note
243+
- type: string
244+
const: DELETED
245+
description: Deleted credit note
246+
- type: string
247+
const: AUTHORISED
248+
description: Authorised credit note
249+
- type: string
250+
const: PAID
251+
description: Paid credit note
252+
- type: string
253+
const: VOIDED
254+
description: Voided credit note
255+
required:
256+
- data
224257
responses:
225258
401InvalidWebhookData:
226259
description: Return a 401 status to indicate that the webhook subscription failed

0 commit comments

Comments
 (0)