Invoice Created
The invoice.created event is triggered when a new invoice is created in the system.
Event Properties
Section titled “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
Section titled “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
Section titled “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
Section titled “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
Section titled “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
Section titled “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
Section titled “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" } }}