Skip to main content
Twelve events cover customers, subscriptions and invoices. Choose the ones you need when you add an endpoint.

Event types

There’s also webhook.test, sent by Send Test Event. You can’t subscribe to it.

Tracked fields

An event’s data.object holds these fields and no others. Only a change to one of them creates an updated event. A change to any other field is not announced, which stops a busy subscription announcing itself every minute. Every data.object also has id and object.
These are the same values the API returns, in the same formats. data.object is a summary, not the full object. Fetch the full object with GET /v1/{customers|subscriptions|invoices}/{id}.

How the events relate

  • created has no previous_attributes.
  • updated carries previous_attributes with the earlier value of each field that changed.
  • deleted carries the object as it was just before it was deleted.
  • invoice.paid, invoice.voided and invoice.deleted replace invoice.updated when the status changes to that value. A status change to anything else, or any other tracked change, is invoice.updated.
  • subscription.ended replaces subscription.updated when the status moves to ended or complete. If other fields change in the same minute, you’ll also get a subscription.updated.
  • A move between ended and complete isn’t announced.

Example payloads

Customer created

Subscription updated

Units went from 10 to 15.

Invoice paid

Invoice failed to sync

An invoice.updated event when Xero refuses an invoice.

Test event

Send Test Event sends an event about no object, so you can check your wiring.

Handling events

1

Verify the signature

Reject anything that fails. See Verify signatures.
2

Skip repeats

Look up Saasybill-Event-Id. If you have processed it, reply 200 and stop.
3

Reply straight away

Return 200 before you do slow work.
4

Fetch the current state

Use data.object.id to fetch the full object from the API, and act on what it is now. This copes with events that arrive late or out of order.