Invoice Webhooks
Detailed information about invoice webhook events including invoice.created and invoice.updated.
invoice.created
The invoice.created event is triggered when a new invoice is created in the system.
Event Properties
| Field | Type | Description |
|---|---|---|
| id | string | Unique identifier for the invoice |
| number | string | Invoice number (e.g., "AA12345678") |
| state | string | Invoice state (issued, pending, voided, allowance_issued, reissuing) |
| category | string | Invoice category (b2b or b2c) |
| currency | string | Currency code (ISO 4217 format) |
| amount | number | Total invoice amount |
| buyer_name | string | Name of the buyer |
| buyer_ubn | string or null | Buyer's Unified Business Number (for B2B invoices) |
| created_at | string | Timestamp of invoice creation (ISO 8601 format) |
| updated_at | string | Timestamp of last update (ISO 8601 format) |
Invoice States
The state field can have the following values:
issued: Invoice has been issued to the customerpending: Invoice is awaiting processingvoided: Invoice has been voided/cancelledallowance_issued: Allowance (折讓) has been issued for this invoicereissuing: 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
| Field | Type | Description |
|---|---|---|
| payment.id | string | Unique payment identifier |
| payment.trade_no | string | Trade number for the payment |
| payment.amount | number | Payment amount |
User Information
| Field | Type | Description |
|---|---|---|
| user.id | string | Unique user identifier |
| user.email | string | User's email address |
| user.name | string | User's name |
Example Payload
{
"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"
}
}
}B2B Invoice Example
For business-to-business invoices, the buyer_ubn field will contain the company's Unified Business Number:
{
"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"
}
}
}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
| Field | Type | Description |
|---|---|---|
| id | string | Unique identifier for the invoice |
| number | string | Invoice number (e.g., "AA12345678") |
| state | string | Invoice state (issued, pending, voided, allowance_issued, reissuing) |
| category | string | Invoice category (b2b or b2c) |
| currency | string | Currency code (ISO 4217 format) |
| amount | number | Total invoice amount |
| buyer_name | string | Name of the buyer |
| buyer_ubn | string or null | Buyer's Unified Business Number (for B2B invoices) |
| created_at | string | Timestamp of invoice creation (ISO 8601 format) |
| updated_at | string | Timestamp of last update (ISO 8601 format) |
Invoice States
The state field can have the following values:
issued: Invoice has been issued to the customerpending: Invoice is awaiting processingvoided: Invoice has been voided/cancelledallowance_issued: Allowance (折讓) has been issued for this invoicereissuing: 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
| Field | Type | Description |
|---|---|---|
| payment.id | string | Unique payment identifier |
| payment.trade_no | string | Trade number for the payment |
| payment.amount | number | Payment amount |
User Information
| Field | Type | Description |
|---|---|---|
| user.id | string | Unique user identifier |
| user.email | string | User's email address |
| user.name | string | User's name |
Common Update Scenarios
Invoice Voided
When an invoice is voided, the state field will change to voided:
{
"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:
{
"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
{
"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_attimestamp will always reflect the time of the most recent update - Monitor the
statefield to track invoice lifecycle changes - For B2B invoices, the
buyer_ubnfield will contain the company's Unified Business Number