1. Module Scope
The Invoice Module enables merchants to create, view, search, manage, and export invoices used for crypto payment collection.
Invoices can be generated directly from the Invoice module or indirectly from other payment service flows such as:
| Source |
Description |
| QR Code |
Invoice can be linked to QR Code payment |
| Checkout Link |
Invoice can be linked to Checkout Link payment |
| API Payment |
Invoice can be created or referenced through API |
| Manual Creation |
Merchant creates invoice manually from Merchant Portal |
In scope:
- Invoice list page
- Advanced invoice filters
- Create Invoice modal
- Invoice detail / preview modal
- Invoice status tracking
- Export invoices to CSV, Excel, and PDF
- Download single invoice PDF
- Mapping invoices to order, product, customer, virtual account, hot wallet, network, asset, and payment transaction
- Read-only invoice detail after generation
- System-driven invoice status update
Out of scope:
- Manual payment confirmation
- Manual invoice status override
- Fiat invoice settlement
- Tax calculation engine, unless configured separately
- Refund processing
- Accounting system integration
2. User Roles
| Role |
Permissions |
| Merchant Admin |
Full access: view, create, export, download PDF, view detail |
| Merchant Finance |
View, filter, export, download PDF, view detail |
| Merchant Operator |
View and create invoices |
| Merchant Support |
View invoice list and detail only |
| Merchant Developer |
Read-only access for integration/debugging |
| Merchant Viewer |
Read-only access |
3. Functional Requirements
3.1 Invoice List Page
F1. View Invoice List

Description:
Displays a paginated list of invoices created by or generated for the merchant.
Page Header
| UI Element |
Description |
| Breadcrumb |
Home / Invoices |
| Page Title |
Invoices |
| Export CSV |
Export filtered invoice list as CSV |
| Export Excel |
Export filtered invoice list as Excel |
| Export PDF |
Export filtered invoice list as PDF |
| Create Invoice |
Opens Create Invoice modal |
Table Columns
| Column |
Description |
| # |
Row number |
| Invoice ID |
Invoice code, clickable |
| Order ID |
Merchant order reference, clickable |
| Product Code |
Primary product code or first product item code |
| Customer Email |
Customer billing email |
| Amount |
Invoice total amount and asset |
| Invoice Date |
Invoice creation date |
| Due Date |
Invoice expiry / due date |
| Status |
Paid / Pending / Overdue / Cancelled |
Rules
| Rule ID |
Rule |
| INV-LIST-01 |
Only invoices belonging to the current merchant are displayed |
| INV-LIST-02 |
Default sorting is Invoice Date DESC |
| INV-LIST-03 |
Invoice ID is clickable and opens invoice detail modal |
| INV-LIST-04 |
Order ID is clickable and may open invoice detail or linked order reference |
| INV-LIST-05 |
Status must be displayed as color badge |
| INV-LIST-06 |
Amount must display value and asset, for example 1,250.00 USDT |
| INV-LIST-07 |
Pagination must display record count and current page |
| INV-LIST-08 |
Empty result must show empty state |
| INV-LIST-09 |
Export buttons export only the current filtered result set |
3.2 Advanced Invoice Filters
F2. Filter Invoice List
Description:
Allows merchant to search invoices using multiple conditions.
Filters
| Filter |
Type |
Placeholder / Value |
| Hot Wallet |
Dropdown |
All Hot Wallets |
| Network |
Dropdown |
All Networks |
| Virtual Account Address |
Text input |
Enter virtual account address |
| Invoice ID |
Text input |
Enter invoice id |
| Order ID |
Text input |
Enter order id |
| Customer Email |
Text input |
Enter customer email |
| Product Code |
Text input |
Enter product code |
| Amount From |
Number input |
Min amount |
| Amount To |
Number input |
Max amount |
| Invoice Date From |
Date picker |
dd/mm/yyyy |
| Invoice Date To |
Date picker |
dd/mm/yyyy |
| Status |
Dropdown |
All Status |
| Search |
Button |
Applies filters |
Rules
| Rule ID |
Rule |
| INV-FILTER-01 |
Filters can be combined |
| INV-FILTER-02 |
Empty filters return all invoices |
| INV-FILTER-03 |
Amount From must be less than or equal to Amount To |
| INV-FILTER-04 |
Invoice Date From must be less than or equal to Invoice Date To |
| INV-FILTER-05 |
Customer Email must support partial search |
| INV-FILTER-06 |
Invoice ID and Order ID must support exact or partial search |
| INV-FILTER-07 |
Virtual Account Address supports full or partial address search |
| INV-FILTER-08 |
Search button triggers backend query |
| INV-FILTER-09 |
Export uses current applied filters |
3.3 Create Invoice
F3. Create Invoice Modal

Description:
Allows merchant to create a new invoice for payment collection.
Triggered By
| Trigger |
Behavior |
| Create Invoice button on Invoice List page |
Opens Create Invoice modal |
| Plus icon from QR Code creation flow |
Opens Create Invoice modal |
| Plus icon from Checkout Link creation flow |
Opens Create Invoice modal |
Modal Header
| UI Element |
Description |
| Title |
Create Invoice |
| Subtitle |
Create a new invoice for payment collection |
| Close Icon |
Closes modal after confirmation if form is dirty |
General Fields
| Field |
Required |
Type |
Description |
| Order ID |
Yes |
Text input |
Merchant order reference |
| Customer ID |
No |
Text input |
Merchant customer identifier |
| Customer Email |
Yes |
Email input |
Customer billing email |
| Expiry Time |
Yes |
Datetime picker |
Due date / invoice expiry datetime |
| Asset |
Yes |
Dropdown |
USDT / USDC / supported asset |
Product Fields
| Field |
Required |
Type |
Description |
| Product ID |
Yes |
Text input |
Product code |
| Product Name |
Yes |
Text input |
Product name |
| Price |
Yes |
Number input |
Unit price |
| Quantity |
Yes |
Number input |
Product quantity |
| Total |
System calculated |
Read-only / number |
Price × Quantity |
| Delete Product |
Conditional |
Icon button |
Removes product row |
Other Fields
| Field |
Required |
Type |
Description |
| Add Product |
No |
Button |
Adds another product row |
| Notes |
No |
Textarea |
Optional invoice note |
| Invoice Total |
System calculated |
Read-only |
Sum of product totals |
Actions
| Button |
Behavior |
| Cancel |
Closes modal |
| Create Invoice |
Creates invoice |
Rules
| Rule ID |
Rule |
| INV-CREATE-01 |
Order ID is required |
| INV-CREATE-02 |
Customer Email is required |
| INV-CREATE-03 |
Customer Email must be valid email format |
| INV-CREATE-04 |
Expiry Time is required |
| INV-CREATE-05 |
Expiry Time must be greater than current datetime |
| INV-CREATE-06 |
Asset is required |
| INV-CREATE-07 |
At least one product row is required |
| INV-CREATE-08 |
Product ID is required |
| INV-CREATE-09 |
Product Name is required |
| INV-CREATE-10 |
Price must be greater than or equal to 0 |
| INV-CREATE-11 |
Quantity must be greater than 0 |
| INV-CREATE-12 |
Product Total \= Price × Quantity |
| INV-CREATE-13 |
Invoice Total \= Sum of all product totals |
| INV-CREATE-14 |
Create Invoice button is disabled until validation passes |
| INV-CREATE-15 |
After creation, invoice status is Pending by default |
| INV-CREATE-16 |
Invoice content becomes immutable after creation |
| INV-CREATE-17 |
If invoice is created from QR/Checkout flow, new Invoice ID is returned to parent form |
3.4 Invoice Detail Modal
F4. View Invoice Detail

Description:
Displays full invoice information in a printable, read-only layout.
Triggered By
| Trigger |
Behavior |
| Click Invoice ID |
Opens Invoice Detail modal |
| Click View Invoice action |
Opens Invoice Detail modal |
| Click invoice from QR/Checkout search modal |
Opens or selects invoice depending context |
Header Section
| Field |
Description |
| Title |
INVOICE |
| Subtitle |
Payment Gateway Invoice |
| Status Badge |
Paid / Pending / Overdue / Cancelled |
Merchant / From Section
| Field |
Description |
| Merchant Name |
Merchant display name |
| Merchant ID |
Merchant identifier |
| Blockchain |
Invoice payment blockchain/network |
Bill To Section
| Field |
Description |
| Customer Email |
Customer billing email |
| Customer ID |
Optional customer identifier |
Invoice Metadata Section
| Field |
Description |
| Invoice ID |
Invoice number/code |
| Order ID |
Merchant order reference |
| Invoice Date |
Invoice creation date |
| Due Date |
Expiry / due date |
| Paid Date |
Payment completion date, if paid |
Invoice Item Table
| Column |
Description |
| Item Description |
Product name / description |
| Qty |
Quantity |
| Unit Price |
Price per unit and asset |
| Total |
Line total and asset |
Summary Section
| Field |
Description |
| Subtotal |
Sum before tax |
| Tax |
Tax amount, default 0 if not configured |
| Total Amount |
Final payable amount |
Notes Section
| Field |
Description |
| Notes |
Merchant notes, or “No additional notes” |
Actions
| Button |
Behavior |
| Close |
Closes modal |
| Download PDF |
Optional action if shown |
| Print |
Optional action if supported |
Rules
| Rule ID |
Rule |
| INV-DETAIL-01 |
Invoice detail is read-only |
| INV-DETAIL-02 |
Invoice content must be immutable after generation |
| INV-DETAIL-03 |
Status badge color must match status |
| INV-DETAIL-04 |
Paid Date is shown only when invoice is Paid |
| INV-DETAIL-05 |
Amount values must show asset |
| INV-DETAIL-06 |
PDF layout should match invoice detail layout |
| INV-DETAIL-07 |
Detail modal must not allow editing invoice fields |
3.5 Invoice Status Management
F5. System-Driven Invoice Status
Description:
Invoice status is updated automatically by payment and transaction events.
Statuses
| Status |
Description |
Badge Color |
| Pending |
Invoice is waiting for payment |
Yellow |
| Paid |
Invoice has been fully paid |
Green |
| Overdue |
Invoice due date has passed without successful payment |
Red |
| Cancelled |
Invoice was cancelled or linked transaction was cancelled |
Gray |
Status Transition
| From |
To |
Trigger |
| Pending |
Paid |
Payment success event |
| Pending |
Overdue |
Due date / expiry reached |
| Pending |
Cancelled |
Transaction or invoice cancellation |
| Overdue |
Paid |
Late payment accepted, only if policy allows |
| Paid |
No change |
Paid invoice is final |
| Cancelled |
No change |
Cancelled invoice is final |
Rules
| Rule ID |
Rule |
| INV-STATUS-01 |
Manual status change is not allowed |
| INV-STATUS-02 |
Invoice becomes Paid only after confirmed successful payment |
| INV-STATUS-03 |
Invoice becomes Overdue when due date passes and no successful payment exists |
| INV-STATUS-04 |
Paid invoice cannot become Pending again |
| INV-STATUS-05 |
Cancelled invoice cannot accept new payment |
| INV-STATUS-06 |
Overdue invoice cannot accept payment unless merchant policy allows late payment |
| INV-STATUS-07 |
Status change must be audit logged |
3.6 Export Invoices
F6. Export Invoice List
Description:
Allows merchant to export invoices for finance and accounting.
Export Buttons
| Button |
Format |
Behavior |
| Export CSV |
.csv |
Exports filtered invoice summary |
| Export Excel |
.xlsx |
Exports filtered invoice summary |
| Export PDF |
.pdf |
Exports filtered invoice summary or printable invoice report |
Export Fields
| Field |
Included |
| Invoice ID |
Yes |
| Order ID |
Yes |
| Product Code |
Yes |
| Customer Email |
Yes |
| Amount |
Yes |
| Asset |
Yes |
| Invoice Date |
Yes |
| Due Date |
Yes |
| Paid Date |
Yes, if available |
| Status |
Yes |
| Hot Wallet |
Optional |
| Network |
Optional |
| Virtual Account Address |
Optional |
Rules
| Rule ID |
Rule |
| INV-EXPORT-01 |
Export respects current filters |
| INV-EXPORT-02 |
Export includes only invoices owned by current merchant |
| INV-EXPORT-03 |
Export action requires permission |
| INV-EXPORT-04 |
Large export should be handled asynchronously |
| INV-EXPORT-05 |
Export file name should include date/time |
| INV-EXPORT-06 |
Export action must be audit logged |
| INV-EXPORT-07 |
PDF export should use printable layout |
4. Data Requirements
invoice_code_counters
| Field |
Type |
Required |
Description |
| merchant_id |
String |
No |
Owning merchant identifier |
| last_number |
Integer |
Yes |
Last allocated sequence number |
| updated_at |
DateTime |
Yes |
Last updated timestamp (UTC) |
invoice_export_logs
| Field |
Type |
Required |
Description |
| export_id |
UUID |
No |
Export job identifier |
| merchant_id |
String |
Yes |
Owning merchant identifier |
| user_id |
String |
Yes |
Acting user id |
| export_format |
String |
Yes |
Export format (csv / pdf / …) |
| filters |
JSON |
No |
Serialized export filters |
| file_url |
String |
Yes |
Document/file URL |
| file_name |
String |
Yes |
Stored file name |
| content_type |
String |
Yes |
MIME type |
| status |
String |
Yes |
Lifecycle status (active / inactive / domain-specific values) |
| error_message |
String |
Yes |
Error detail |
| created_at |
DateTime |
Yes |
Created timestamp (UTC) |
| completed_at |
DateTime |
No |
Completion timestamp |
invoice_items
| Field |
Type |
Required |
Description |
| invoice_item_id |
UUID |
No |
Invoice line-item identifier |
| invoice_id |
UUID |
Yes |
Invoice identifier |
| product_id |
String |
Yes |
Line product id |
| product_name |
String |
Yes |
Line product name |
| description |
String |
Yes |
Text description |
| unit_price |
Decimal |
Yes |
Unit price |
| quantity |
Integer |
Yes |
Quantity |
| line_total |
Decimal |
Yes |
Line total |
| display_order |
Integer |
Yes |
Display order of the line |
invoice_status_logs
| Field |
Type |
Required |
Description |
| log_id |
UUID |
No |
Status-change log identifier |
| invoice_id |
UUID |
Yes |
Invoice identifier |
| old_status |
String |
Yes |
Previous status |
| new_status |
String |
Yes |
New status |
| trigger_type |
String |
Yes |
What triggered the status change |
| transaction_id |
String |
Yes |
Linked payment transaction id |
| changed_at |
DateTime |
Yes |
When the status changed |
| metadata |
JSON |
No |
Opaque JSON metadata |
invoices
| Field |
Type |
Required |
Description |
| invoice_id |
UUID |
No |
Invoice identifier |
| invoice_code |
String |
Yes |
Human invoice code |
| merchant_id |
String |
Yes |
Owning merchant identifier |
| merchant_name |
String |
Yes |
Merchant display name |
| order_id |
String |
Yes |
Merchant order reference |
| customer_id |
String |
Yes |
Merchant’s customer identifier |
| customer_email |
String |
Yes |
Customer email |
| hot_wallet_id |
String |
Yes |
Linked hot wallet id |
| virtual_account_id |
String |
Yes |
Linked virtual account id |
| virtual_account_address |
String |
Yes |
VA deposit address shown on invoice |
| network |
String |
Yes |
Network label / chain network |
| asset |
String |
Yes |
Invoice settlement asset symbol |
| subtotal_amount |
Decimal |
Yes |
Subtotal before tax/discount |
| tax_amount |
Decimal |
Yes |
Tax amount |
| total_amount |
Decimal |
Yes |
Invoice total amount |
| status |
String |
Yes |
Invoice status (draft / unpaid / paid / overdue / cancelled / domain values) |
| invoice_date |
DateTime |
Yes |
Invoice issue timestamp |
| due_date |
DateTime |
Yes |
Payment due timestamp |
| paid_date |
DateTime |
No |
Paid timestamp |
| source_type |
String |
Yes |
Origin type of the invoice |
| source_id |
String |
Yes |
Origin resource id |
| transaction_id |
String |
Yes |
Linked payment transaction id |
| notes |
String |
Yes |
Free-text notes |
| created_by |
String |
Yes |
Creator user id |
| created_at |
DateTime |
Yes |
Created timestamp (UTC) |
| updated_at |
DateTime |
No |
Last updated timestamp (UTC) |
| tax_mode |
String |
Yes |
Tax calculation mode |
| customer_name |
String |
Yes |
Customer display name |
| discount_amount |
Decimal |
Yes |
Discount amount |
5. Enums
InvoiceStatus
| Value |
Description |
| PENDING |
Waiting for payment |
| PAID |
Payment completed |
| OVERDUE |
Due date passed |
| CANCELLED |
Cancelled invoice |
InvoiceSourceType
| Value |
Description |
| MANUAL |
Created manually from Invoice module |
| QR_CODE |
Created from QR Code flow |
| CHECKOUT_LINK |
Created from Checkout Link flow |
| API_PAYMENT |
Created from API Payment |
SupportedNetwork
| Value |
Description |
| BSC |
Binance Smart Chain |
| ETHEREUM |
Ethereum |
| TRON |
Tron |
| POLYGON |
Polygon |
SupportedAsset
| Value |
Description |
| USDT |
Tether |
| USDC |
USD Coin |
InvoiceExportFormat
| Value |
Description |
| CSV |
CSV export |
| EXCEL |
Excel export |
| PDF |
PDF export |
6. API Routes
| Method |
Route |
Description |
Request |
Response |
| GET |
/health |
Liveness |
{} |
{status, service} |
| GET |
/api/v1/invoices |
List invoices |
{merchant_id?, hot_wallet_id?, network?, virtual_account_address?, invoice_id?, order_id?, customer_email?, product_code?, amount_from?, amount_to?, status?, invoice_date_from?, invoice_date_to?, sort_by?, sort_direction?, page?, page_size?} (query) |
{data[{invoice_id, invoice_code, merchant_id, order_id, customer_email, asset, total_amount, status, invoice_date, due_date, paid_date?, …}], pagination[{page, limit, total}]} |
| POST |
/api/v1/invoices |
Create invoice |
{order_id, customer_id, customer_name, customer_email, asset, due_date, notes?, source_type?, source_id?, tax_mode?, tax_jurisdiction?, tax_type?, tax_code?, tax_rate?, tax_amount?, discount_amount?, subtotal_amount?, items[{product_id, product_name, description?, unit_price, quantity}]} |
{invoice_id, invoice_code, merchant_id, order_id, customer_*, asset, amounts, tax_*, items[], status, dates, …} |
| GET |
/api/v1/invoices/search |
Search invoices |
same query filters as list |
same as list |
| GET |
/api/v1/invoices/export |
Start export |
{format, …list filters} (query) |
{export_id, status} |
| GET |
/api/v1/invoices/exports/{export_id} |
Export job status |
{export_id} |
{export_id, status, file_url?, file_name?, error_message?} |
| GET |
/api/v1/invoices/exports/{export_id}/file |
Download export file |
{export_id} |
file bytes |
| GET |
/api/v1/invoices/{id} |
Get invoice |
{id, merchant_id?} |
invoice detail payload |
| GET |
/api/v1/invoices/{id}/pdf |
Download PDF |
{id, merchant_id?} |
application/pdf |
| POST |
/internal/v1/invoices/{id}/transitions |
Internal status transition |
{trigger, transaction_id?} |
invoice detail payload |
7. Audit Log Requirements
| Action |
Audit Required |
Captured Fields |
| View Invoice Detail |
Optional |
user, invoice_id, timestamp |
| Create Invoice |
Yes |
user, invoice_id, order_id, total_amount, asset, timestamp |
| Export CSV |
Yes |
user, filters, format, timestamp |
| Export Excel |
Yes |
user, filters, format, timestamp |
| Export PDF |
Yes |
user, filters, format, timestamp |
| Download Invoice PDF |
Yes |
user, invoice_id, timestamp |
| Invoice Status Changed |
Yes |
invoice_id, old_status, new_status, trigger, timestamp |
| Invoice Linked to Transaction |
Yes |
invoice_id, transaction_id, timestamp |
| Invoice Linked to QR Code |
Yes |
invoice_id, qr_id, timestamp |
| Invoice Linked to Checkout Link |
Yes |
invoice_id, checkout_link_id, timestamp |
8. Error Handling
| Scenario |
Expected Behavior |
| Invoice list fails to load |
Show error message and retry option |
| No invoices found |
Show empty state |
| Invalid email |
Show inline validation |
| Missing required field |
Show inline validation |
| Expiry time is in the past |
Show validation error |
| Amount From > Amount To |
Show validation error |
| Invoice Date From > Invoice Date To |
Show validation error |
| Product quantity \<= 0 |
Show validation error |
| Product price \< 0 |
Show validation error |
| Invoice creation fails |
Show error and keep entered data |
| Invoice detail fails to load |
Show error modal |
| Export fails |
Show export error message |
| PDF generation fails |
Show download error |
| User lacks permission |
Show access denied |
| Invoice already paid |
Disable edit/create-link actions where applicable |
Use CasesUse Cases
Detailed use-case catalog for this module is maintained under 08_UC:Catalog use case chi tiết của module này được quản lý tại 08_UC: