Skip to content

Invoice Updated

The invoice.updated event is triggered when an invoice is updated in the system. This includes state changes such as voiding an invoice, issuing an allowance, or reissuing an invoice.

Event Properties

FieldTypeDescription
idstringUnique identifier for the invoice
numberstringInvoice number (e.g., “AA12345678”)
statestringInvoice state (issued, pending, voided, allowance_issued, reissuing)
categorystringInvoice category (b2b or b2c)
currencystringCurrency code (ISO 4217 format)
amountnumberTotal invoice amount
buyer_namestringName of the buyer
buyer_ubnstring or nullBuyer’s Unified Business Number (for B2B invoices)
created_atstringTimestamp of invoice creation (ISO 8601 format)
updated_atstringTimestamp of last update (ISO 8601 format)

Invoice States

The state field can have the following values:

  • issued: Invoice has been issued to the customer
  • pending: Invoice is awaiting processing
  • voided: Invoice has been voided/cancelled
  • allowance_issued: Allowance (折讓) has been issued for this invoice
  • reissuing: Invoice is in the process of being reissued

Invoice Categories

The category field indicates the invoice type:

  • b2c: Business-to-Consumer invoice (for individual buyers)
  • b2b: Business-to-Business invoice (for company buyers)

Payment Information

FieldTypeDescription
payment.idstringUnique payment identifier
payment.trade_nostringTrade number for the payment
payment.amountnumberPayment amount

User Information

FieldTypeDescription
user.idstringUnique user identifier
user.emailstringUser’s email address
user.namestringUser’s name

Common Update Scenarios

Invoice Voided

When an invoice is voided, the state field will change to voided:

Invoice Voided Example
{
"type": "invoice.updated",
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"number": "AA12345678",
"state": "voided",
"category": "b2c",
"currency": "TWD",
"amount": 1000.0,
"buyer_name": "Test User",
"buyer_ubn": null,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T14:20:00Z",
"payment": {
"id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"trade_no": "TEST20240115001",
"amount": 1000
},
"user": {
"id": "00f7407f-219e-4ada-9390-28934d7398d5",
"email": "user@example.com",
"name": "Test User"
}
}
}

Allowance Issued

When an allowance is issued for an invoice, the state field will change to allowance_issued:

Allowance Issued Example
{
"type": "invoice.updated",
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"number": "AA12345678",
"state": "allowance_issued",
"category": "b2c",
"currency": "TWD",
"amount": 1000.0,
"buyer_name": "Test User",
"buyer_ubn": null,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T15:45:00Z",
"payment": {
"id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"trade_no": "TEST20240115001",
"amount": 1000
},
"user": {
"id": "00f7407f-219e-4ada-9390-28934d7398d5",
"email": "user@example.com",
"name": "Test User"
}
}
}

Example Payload

Invoice Updated Data Structure
{
"type": "invoice.updated",
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"number": "AA12345678",
"state": "issued",
"category": "b2c",
"currency": "TWD",
"amount": 1000.0,
"buyer_name": "Test User",
"buyer_ubn": null,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T12:00:00Z",
"payment": {
"id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"trade_no": "TEST20240115001",
"amount": 1000
},
"user": {
"id": "00f7407f-219e-4ada-9390-28934d7398d5",
"email": "user@example.com",
"name": "Test User"
}
}
}

Notes

  • The updated_at timestamp will always reflect the time of the most recent update
  • Monitor the state field to track invoice lifecycle changes
  • For B2B invoices, the buyer_ubn field will contain the company’s Unified Business Number