Skip to content

Commit 498b367

Browse files
committed
feat!: add payments webhook endpoint and schema
BREAKING CHANGE: adds PAYMENT as a new eventCategory oneOf value in xero-webhooks.yaml. Existing strict schema validators may reject this new enum value in webhook payloads; this is expected since subscribers must explicitly opt in to payment events.
1 parent e958fe3 commit 498b367

1 file changed

Lines changed: 127 additions & 0 deletions

File tree

‎xero-webhooks.yaml‎

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,60 @@ webhooks:
171171
$ref: "#/components/responses/200WebhookDataReceivedOk"
172172
"401":
173173
$ref: "#/components/responses/401InvalidWebhookData"
174+
payments:
175+
post:
176+
summary: Payments Webhook Endpoint
177+
description: Payment (Create, Update)
178+
operationId: publishPaymentEvent
179+
tags:
180+
- Events
181+
requestBody:
182+
content:
183+
application/json:
184+
schema:
185+
$ref: "#/components/schemas/PaymentWebhookEvent"
186+
examples:
187+
paymentCreate:
188+
summary: Payment Create Event
189+
value:
190+
events:
191+
- resourceUrl: https://api.xero.com/api.xro/2.0/Payments/717f2bfc-c6d4-41fd-b238-3f2f0c0cf777
192+
resourceId: 717f2bfc-c6d4-41fd-b238-3f2f0c0cf777
193+
tenantId: c2cc9b6e-9458-4c7d-93cc-f02b81b0594f
194+
tenantType: ORGANISATION
195+
eventCategory: PAYMENT
196+
eventType: CREATE
197+
eventDateUtc: 2025-10-21T01:15:39.902
198+
data:
199+
PaymentType: ACCRECPAYMENT
200+
Status: AUTHORISED
201+
UpdatedDateUTCString: 2025-10-21T01:15:39Z
202+
firstEventSequence: 76
203+
lastEventSequence: 76
204+
entropy: FXNGWLCCGVANWHKILRUB
205+
paymentUpdate:
206+
summary: Payment Update Event
207+
value:
208+
events:
209+
- resourceUrl: https://api.xero.com/api.xro/2.0/Payments/717f2bfc-c6d4-41fd-b238-3f2f0c0cf777
210+
resourceId: 717f2bfc-c6d4-41fd-b238-3f2f0c0cf777
211+
tenantId: c2cc9b6e-9458-4c7d-93cc-f02b81b0594f
212+
tenantType: ORGANISATION
213+
eventCategory: PAYMENT
214+
eventType: UPDATE
215+
eventDateUtc: 2025-10-21T02:20:04.117
216+
data:
217+
PaymentType: ACCRECPAYMENT
218+
Status: DELETED
219+
UpdatedDateUTCString: 2025-10-21T02:20:04Z
220+
firstEventSequence: 77
221+
lastEventSequence: 77
222+
entropy: FXNGWLCCGVANWHKILRUB
223+
responses:
224+
"200":
225+
$ref: "#/components/responses/200WebhookDataReceivedOk"
226+
"401":
227+
$ref: "#/components/responses/401InvalidWebhookData"
174228
components:
175229
headers:
176230
x-xero-signature:
@@ -235,6 +289,9 @@ components:
235289
- type: string
236290
const: OVERPAYMENT
237291
description: For organisation overpayment-related events
292+
- type: string
293+
const: PAYMENT
294+
description: For organisation payment-related events
238295
tenantId:
239296
type: string
240297
format: uuid
@@ -440,6 +497,76 @@ components:
440497
description: The date and time the overpayment was last updated in UTC ISO format
441498
required:
442499
- data
500+
PaymentWebhookEvent:
501+
allOf:
502+
- $ref: "#/components/schemas/WebhookEvent"
503+
- type: object
504+
properties:
505+
events:
506+
type: array
507+
items:
508+
allOf:
509+
- $ref: "#/components/schemas/WebhookEvent/properties/events/items"
510+
- type: object
511+
properties:
512+
eventCategory:
513+
const: PAYMENT
514+
data:
515+
type: object
516+
description: Payment lifecycle events for payments applied to and removed from accounting documents
517+
required:
518+
- PaymentType
519+
- Status
520+
- UpdatedDateUTCString
521+
properties:
522+
PaymentType:
523+
type: string
524+
description: The specific type of payment, determined by the type of the document the payment was applied to
525+
externalDocs:
526+
url: https://developer.xero.com/documentation/api/accounting/types#payments
527+
oneOf:
528+
- type: string
529+
const: ACCRECPAYMENT
530+
description: Accounts receivable payment
531+
- type: string
532+
const: ACCPAYPAYMENT
533+
description: Accounts payable payment
534+
- type: string
535+
const: ARCREDITPAYMENT
536+
description: Accounts receivable credit note payment (refund)
537+
- type: string
538+
const: APCREDITPAYMENT
539+
description: Accounts payable credit note payment (refund)
540+
- type: string
541+
const: ARPREPAYMENTPAYMENT
542+
description: Accounts receivable prepayment payment (refund)
543+
- type: string
544+
const: APPREPAYMENTPAYMENT
545+
description: Accounts payable prepayment payment (refund)
546+
- type: string
547+
const: AROVERPAYMENTPAYMENT
548+
description: Accounts receivable overpayment payment (refund)
549+
- type: string
550+
const: APOVERPAYMENTPAYMENT
551+
description: Accounts payable overpayment payment (refund)
552+
Status:
553+
type: string
554+
description: The current lifecycle status of the payment
555+
externalDocs:
556+
url: https://developer.xero.com/documentation/api/accounting/types#payment-status-codes
557+
oneOf:
558+
- type: string
559+
const: AUTHORISED
560+
description: Authorised payment
561+
- type: string
562+
const: DELETED
563+
description: Deleted payment
564+
UpdatedDateUTCString:
565+
type: string
566+
format: date-time
567+
description: The date and time the parent document was last updated in UTC ISO format
568+
required:
569+
- data
443570
responses:
444571
401InvalidWebhookData:
445572
description: Return a 401 status to indicate that the webhook subscription failed

0 commit comments

Comments
 (0)