Skip to content

Invoice Created

The invoice.created event is triggered when a new invoice is created in the system.

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)

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

The category field indicates the invoice type:

  • b2c: Business-to-Consumer invoice (for individual buyers)
  • b2b: Business-to-Business invoice (for company buyers)
FieldTypeDescription
payment.idstringUnique payment identifier
payment.trade_nostringTrade number for the payment
payment.amountnumberPayment amount
FieldTypeDescription
user.idstringUnique user identifier
user.emailstringUser’s email address
user.namestringUser’s name
Invoice Created Data Structure
{
"type": "invoice.created",
"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-15T10:30: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"
}
}
}

For business-to-business invoices, the buyer_ubn field will contain the company’s Unified Business Number:

B2B Invoice Example
{
"type": "invoice.created",
"data": {
"id": "550e8400-e29b-41d4-a716-446655440001",
"number": "BB87654321",
"state": "issued",
"category": "b2b",
"currency": "TWD",
"amount": 5000.0,
"buyer_name": "Example Company Ltd.",
"buyer_ubn": "12345678",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z",
"payment": {
"id": "f47ac10b-58cc-4372-a567-0e02b2c3d480",
"trade_no": "TEST20240115002",
"amount": 5000
},
"user": {
"id": "00f7407f-219e-4ada-9390-28934d7398d6",
"email": "company@example.com",
"name": "Company Admin"
}
}
}