CPG-MP FSD Transaction

FSD — Merchant Portal

A. Document controlA. Kiểm soát tài liệu

Doc IDCPG-FSD-CPG-MP_FSD_Transaction
VersionPhiên bản2.0
StatusTrạng tháiDraft
OwnerCPG BA / Architecture
AudienceĐối tượngFrontend, Backend, QA, Product
ClassificationPhân loạiInternal
Effective dateNgày hiệu lực01/12/2026
Related docs Merchant Portal Index · BR/NFR Catalog

B. Version historyB. Lịch sử phiên bản

Version Date Author ChangesThay đổi
1.0 17/01/2026 Khoa Trinh Version 1.0
2.0 22/06/2026 Khoa Trinh Release v2.0 (New fund flow, add Virtual Account)

C. Table of contentsC. Mục lục

D. ContentD. Nội dung

1. Module Scope

The Transactions Module enables merchants to monitor, search, inspect, refund, and manage webhook delivery for crypto transactions processed through the Crypto Payment Gateway.
The updated module is organized by account source:

Main Tab Purpose
Hot Wallets View transactions processed through merchant Hot Wallets
Virtual Account View transactions mapped to customer Virtual Accounts

The Virtual Account tab contains two sub-tabs:

Sub Tab Purpose
Payment Transactions View customer payment transactions
Refund Transactions View refund transactions linked to original payments

In scope:

  • View Hot Wallet payment transactions
  • View Virtual Account payment transactions
  • View Virtual Account refund transactions
  • Advanced filtering by wallet, transaction, invoice, customer, address, network, asset, amount, status, compliance, risk, date, webhook
  • View Transaction Details modal
  • Initiate refund from Transaction Details
  • Initiate refund from Refund Transactions tab
  • Process partial or full refund
  • Track webhook delivery status
  • Resend webhook manually
  • Copy transaction hash, wallet address, transaction ID
  • Open transaction hash and wallet address in blockchain explorer
  • Display risk and compliance status
  • Audit all sensitive operations

Out of scope:

  • Fiat transaction processing
  • Fiat refund processing
  • Manual blockchain transaction signing from raw transaction data
  • Admin-side force status override
  • On/off ramp transaction settlement

2. User Roles

Role Permissions
Merchant Admin Full access: view, filter, detail, refund, resend webhook
Merchant Finance View, filter, detail, initiate refund, resend webhook if enabled
Merchant Operator View, filter, detail, copy/open explorer
Merchant Support View-only, copy/open explorer, no refund
Merchant Developer Read-only, webhook debugging, copy transaction/hash
Merchant Viewer Read-only access only

3. Functional Requirements

3.1 Transactions Page Common Layout

F1. Transactions Landing Page

Description:
The Transactions page displays transaction data by wallet source and transaction type.
Page Header

UI Element Description
Breadcrumb Home / Transactions
Page Title Transactions
Main Tabs Hot Wallets / Virtual Account
Primary Action Resend Webhook

Rules

  • Default main tab: Hot Wallets
  • When Virtual Account tab is selected, show sub-tabs:
  • Payment Transactions
  • Refund Transactions
  • Filters and tables are tab-specific.
  • Search is triggered only when user clicks Search.
  • Empty filters return all accessible transactions.
  • Merchant can only view transactions belonging to the current merchant.
  • Default sorting: latest transaction first.
  • All monetary values must show amount and asset symbol.
  • Transaction hash and wallet address are displayed in shortened format.
  • Copy action must copy full value.
  • Explorer icon must open correct explorer based on blockchain and network.
  • Status values must be displayed as badges.

3.2 Hot Wallet Transactions

F2. Hot Wallet Transactions List

Description:
Displays payment transactions associated with merchant Hot Wallets.
Main Tab: Hot Wallets
Primary Action

Button Behavior
Resend Webhook Resends webhook for selected transaction rows

Filters

Filter Type Description
Hot Wallet Dropdown All Hot Wallets / specific Hot Wallet
Transaction ID Text input Search by internal transaction ID
Transaction Hash Text input Search by blockchain transaction hash
Invoice ID Text input Search by invoice/order reference
Payment Service Dropdown All Payment Services / QR Payment / Payment Link / API Payment
Webhook Status Dropdown All Webhook Status / Sent / Pending / Failed
Risk Status Dropdown All Risk Status / Low / Medium / High
Compliance Status Dropdown All Compliance Status / Approved / In Review / Rejected
Txn Status Dropdown All Status / Success / Pending / Failed
Search Button Applies filters

Table Columns

Column Description
Checkbox Select transaction for webhook resend
# Row number
TX ID / Hash Internal transaction ID and shortened blockchain hash with copy/explorer icons
Invoice ID Invoice or order reference
Virtual Account Virtual account address and payee email
Amount Amount and asset, for example 1,250.00 USDT
Status Transaction status badge
Risk Risk status badge
Compliance Compliance status badge
Timestamp Transaction timestamp
Webhook Webhook delivery status badge

Rules

  • Transaction row click opens Transaction Details modal.
  • Checkbox selection is used for manual webhook resend.
  • Resend Webhook button is enabled only when at least one transaction is selected.
  • Failed, Pending, and Sent webhook statuses may be resent.
  • Payment Service filter must match service source:
  • QR Payment
  • Payment Link
  • API Payment
  • Risk and compliance badges must match latest risk/compliance result.
  • A transaction with Compliance Status \= Rejected cannot be refunded.
  • Failed transaction cannot be refunded.
  • Pending transaction cannot be refunded until confirmed.

3.3 Virtual Account Payment Transactions

F3. Virtual Account Payment Transactions List

Description:
Displays customer-level payment transactions mapped to Virtual Accounts.
Main Tab: Virtual Account
Sub Tab: Payment Transactions
Filters

Filter Type Description
Hot Wallet Dropdown All Hot Wallets / specific Hot Wallet
Transaction ID Text input Search by internal transaction ID
Transaction Hash Text input Search by blockchain transaction hash
Invoice ID Text input Search by invoice/order ID
Customer ID Text input Search by merchant customer ID
Address Text input Search by Virtual Account address
Network Dropdown All Networks / BSC Mainnet / Ethereum Mainnet / Polygon Mainnet / BSC Testnet / others
Assets Dropdown All Assets / USDT / USDC / others
From Amount Number input Minimum transaction amount
To Amount Number input Maximum transaction amount
Transaction From Date picker Transaction start date
Transaction To Date picker Transaction end date
Compliance Status Dropdown All Compliance Status / Approved / In Review / Rejected
Webhook Status Dropdown All Webhook Status / Sent / Pending / Failed
Txn Status Dropdown All Status / Success / Pending / Failed
Search Button Applies filters

Table Columns

Column Description
Checkbox Select transaction for webhook resend
# Row number
TX ID / Hash Internal transaction ID and shortened transaction hash with copy/explorer icons
Invoice ID Invoice/order reference
Customer ID Merchant customer identifier
Amount Payment amount and asset
Status Transaction status badge
Risk Risk status badge
Compliance Compliance status badge
Timestamp Transaction timestamp
Webhook Webhook delivery status badge

Rules

  • Transaction row click opens Transaction Details modal.
  • Invoice ID is clickable if invoice module route exists.
  • Customer ID is displayed if transaction is mapped to a Virtual Account customer.
  • Amount filter applies to transaction amount in selected asset.
  • If multiple assets are selected, amount range applies per asset after normalization.
  • Date range must satisfy Transaction From ≤ Transaction To.
  • Address filter supports full or partial address.
  • Network and Asset filters must be compatible.
  • Search result must respect merchant scope and role permissions.

3.4 Virtual Account Refund Transactions

F4. Virtual Account Refund Transactions List

Description:
Displays refund transactions initiated against original payment transactions.
Main Tab: Virtual Account
Sub Tab: Refund Transactions
Primary Action

Button Behavior
Initial Refund Transaction Opens refund initiation flow

Filters

Filter Type Description
Hot Wallet Dropdown All Hot Wallets / specific Hot Wallet
Original Txn Hash Text input Search by original payment transaction hash
Transaction Hash Text input Search by refund transaction hash
Invoice ID Text input Search by invoice/order ID
Customer ID Text input Search by customer ID
Address Text input Search by receiver/refund address or virtual account address
Network Dropdown All Networks
Assets Dropdown All Assets / USDT / USDC / others
From Amount Number input Minimum refund amount
To Amount Number input Maximum refund amount
Transaction From Date picker Refund transaction start date
Transaction To Date picker Refund transaction end date
Created By Dropdown All Creators / specific user
Webhook Status Dropdown All Webhook Status / Sent / Pending / Failed
Txn Status Dropdown All Status / Success / Pending / Failed
Search Button Applies filters

Table Columns

Column Description
Checkbox Select refund transaction for webhook resend
# Row number
Refund Txn Hash Refund on-chain transaction hash with copy/explorer icons
Original Tx Original payment transaction hash with copy icon
Invoice ID Original invoice/order reference
Customer ID Customer identifier
Amount Refund amount and asset
Created By User who initiated refund
Timestamp Refund creation timestamp
Webhook Refund webhook delivery status
Status Refund transaction status

Rules

  • Default sorting: Timestamp DESC.
  • Refund transaction hash opens blockchain explorer.
  • Original transaction hash opens original Transaction Details modal.
  • Created By is the user who initiated the refund.
  • Refund records must be immutable after creation except status and webhook delivery metadata.
  • Refund status is updated asynchronously by chain listener.
  • Failed refund can be retried only by initiating a new refund transaction if refundable amount remains.
  • Refund amount must reduce remaining refundable amount of the original transaction only after successful confirmation.

3.5 Transaction Details

F5. Transaction Details Modal

Description:
Displays full payment transaction details.
Modal Header

UI Element Description
Title Transaction Details
Status Badge Success / Pending / Failed
Close Icon Closes modal

Fields

Field Description
Transaction ID Internal transaction ID with copy icon
Transaction Hash Blockchain transaction hash with copy icon
Order ID Merchant order or invoice reference
Merchant Merchant name
Amount Amount and asset
From Address Sender wallet address with copy icon
To Address Receiver wallet or Virtual Account address with copy icon
Blockchain Blockchain name, for example BSC
Timestamp Transaction timestamp

Actions

Button Behavior
Initial Refund Opens Process Refund modal if transaction is refundable

Rules

  • Modal is read-only.
  • Transaction Hash, From Address, and To Address must support copy action.
  • Transaction Hash and addresses should support explorer opening.
  • Initial Refund button is visible only if user has refund permission.
  • Initial Refund button is enabled only if refund eligibility rules pass.
  • If transaction is not refundable, button is hidden or disabled with tooltip.

3.6 Refund Processing

F6. Refund Eligibility

Description:
Determines whether a payment transaction can be refunded.
Refund is allowed only when all conditions are true:

Condition Rule
Transaction Status Must be Success
Compliance Status Must be Approved
Risk Status Must not be blocked by policy
Refundable Amount Must be greater than 0
Refund State Must not be fully refunded
Asset Must support refund
Network Must be active and supported
Receiver Address Must be known or provided
Merchant Permission User must have refund permission
Wallet Readiness Refund source wallet must be active and have sufficient balance/gas if merchant-signed
Duplicate Protection Same refund request must not already be pending

Not refundable examples

Scenario Result
Transaction Pending Refund disabled
Transaction Failed Refund disabled
Compliance Rejected Refund disabled
Fully refunded Refund disabled
Refund amount exceeds remaining amount Refund blocked
Network disabled Refund blocked
Hot Wallet inactive Refund blocked unless admin override policy exists

F7. Process Refund Modal

Description:
Allows merchant to initiate a partial or full refund.
Modal Title: Process Refund
Description Text:
Initiate a partial or full refund for this transaction.
Fields

Field Required Type Description
Refund Amount Yes Number input Refund amount, editable
Receiver Address Yes Read-only or editable based on policy Destination address for refund
Reason Yes Text input / dropdown Refund reason
Description No Textarea Additional refund details
Estimated Fee System calculated Read-only Estimated refund fee

Buttons

Button Behavior
Cancel Closes modal
Confirm Refund Submits refund request

Rules

  • Refund Amount is required.
  • Refund Amount must be greater than 0.
  • Refund Amount must be less than or equal to remaining refundable amount.
  • Refund Amount decimal precision must follow asset decimals.
  • Receiver Address is required.
  • Receiver Address must match blockchain address format.
  • Reason is required.
  • Description is optional.
  • Estimated Fee is auto-calculated.
  • Confirm Refund is disabled while validation or fee estimation is loading.
  • Confirmation action must be audit logged.

Estimated Fee Rules

Fee Type Description
Network Gas Fee Estimated native-chain gas fee
Platform Refund Fee Optional platform fee if configured
Total Estimated Fee Displayed to merchant before confirmation

F8. Refund Execution Flow

Step Description
1 User clicks Initial Refund from Transaction Details or Initial Refund Transaction from Refund Transactions tab
2 System loads original transaction
3 System validates refund eligibility
4 System opens Process Refund modal
5 User enters refund amount, reason, and optional description
6 System validates receiver address, remaining refundable amount, compliance, risk, wallet status, and balance
7 System calculates estimated fee
8 User clicks Confirm Refund
9 System creates refund request
10 Refund is signed and broadcast according to custody/signing model
11 Refund transaction hash is recorded
12 Refund appears in Refund Transactions list
13 Original transaction refundable amount is updated
14 Refund webhook is sent to merchant endpoint

Signing Model Rules

Model Behavior
Merchant Web3 Wallet Merchant signs refund transaction using registered wallet
Web3Auth Wallet Merchant signs through Web3Auth wallet if supported
Partial Custody Batch Refund System marks refund as refund_ready and processes later by batch
Post-settlement Refund Merchant wallet funds the refund and contract validates amount before transfer
Pre-settlement Refund System processes refund from held amount before settlement

F9. Refund Status Lifecycle

Status Description
Draft Refund form opened but not submitted
Pending Refund submitted or broadcast, awaiting confirmation
Processing Refund is being signed, broadcast, or batch processed
Success Refund confirmed on-chain
Failed Refund failed, reverted, rejected, or broadcast failed
Cancelled Refund request cancelled before broadcast
Rejected Refund blocked by business, risk, or compliance rule

Rules

  • Refund record is created only after user confirms refund, except when system explicitly stores draft.
  • Refund status must be updated by chain listener/indexer.
  • Failed refund must preserve failure reason.
  • Success refund must include confirmed transaction hash and confirmation timestamp.
  • Original transaction must show updated refunded amount and remaining refundable amount.

3.7 Webhook Management

F10. Webhook Status Tracking

Description:
Tracks webhook delivery for both payment and refund transactions.
Webhook Statuses

Status Meaning
Sent Webhook delivered successfully with 2xx response
Pending Webhook is waiting for first delivery or retry
Failed Webhook delivery failed after max retries

Rules

  • Webhook status is shown in transaction tables.
  • Webhook status is updated after each delivery attempt.
  • Webhook delivery attempts must be logged.
  • Payment and refund webhooks are tracked separately.
  • Webhook status must not change transaction status.

F11. Resend Webhook

Description:
Allows authorized users to resend webhook for selected transactions.
Triggered By

Trigger Behavior
Select checkbox and click Resend Webhook Resends webhook for selected transactions

Rules

  • User must have webhook resend permission.
  • At least one transaction must be selected.
  • Resend Webhook button is disabled if no transaction is selected.
  • System must confirm selected transaction count before sending if more than one row is selected.
  • Resend action must create a new webhook delivery attempt.
  • Original webhook history must be preserved.
  • Resend is rate-limited.
  • Resend supports Payment Transactions and Refund Transactions.
  • Resend result must show success/failure toast.

Validation

Scenario Behavior
No selected transaction Disable button
Webhook endpoint not configured Block resend and show error
Transaction not found Skip and show partial failure
User lacks permission Show access denied
Rate limit exceeded Show rate limit message
Endpoint returns non-2xx Mark delivery attempt failed

3.8 Common Transaction Actions

F12. Copy Transaction Data

Copy Target Behavior
Transaction ID Copy full internal transaction ID
Transaction Hash Copy full blockchain transaction hash
From Address Copy full sender address
To Address Copy full receiver address
Original Tx Hash Copy full original transaction hash
Refund Tx Hash Copy full refund transaction hash

Rules

  • Display success toast after copy.
  • Copy full value, not shortened display text.

F13. Open Explorer

Target Behavior
Transaction Hash Open transaction hash in chain explorer
Refund Tx Hash Open refund transaction hash in chain explorer
Wallet Address Open wallet address in chain explorer

Rules

  • Explorer URL must be generated from blockchain and network type.
  • Mainnet and testnet explorers must use different templates.
  • If explorer configuration is missing, disable icon and show tooltip.
  • Explorer opens in new browser tab.

4. Use 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:

5. User Interface Specification

5.1 Transactions Page

UI Element Description
Breadcrumb Home / Transactions
Page Title Transactions
Main Tabs Hot Wallets / Virtual Account
Secondary Tabs Payment Transactions / Refund Transactions under Virtual Account
Resend Webhook Button Top-right primary action
Filter Panel Dynamic by selected tab
Search Button Applies filters
Data Table Dynamic by selected tab
Row Checkbox Selects transaction for webhook resend
Status Badges Color-coded statuses

5.2 Hot Wallets Tab UI


Filters

Field Placeholder / Value
Hot Wallet All Hot Wallets
Transaction ID Enter tx ID
Transaction Hash Enter tx hash
Invoice ID Enter invoice ID
Payment Service All Payment Services
Webhook Status All Webhook Status
Risk Status All Risk Status
Compliance Status All Compliance Status
Txn Status All Status

Table

Column Example
TX ID / Hash TX1001 / 0x7f3d...a8f9
Invoice ID ORD123456789
Virtual Account 0xC8Fd6867...7890 / payee@example.com
Amount 1,250.00 USDT
Status Success
Risk Low
Compliance Approved
Timestamp Dec 8, 2024 10:30 AM
Webhook Sent

5.3 Virtual Account Payment Transactions UI


Filters

Field Placeholder / Value
Hot Wallet All Hot Wallets
Transaction ID Enter tx ID
Transaction Hash Enter tx hash
Invoice ID Enter invoice ID
Customer ID Search by Customer ID
Address Search by address
Network All Networks
Assets All Assets
From Amount Min amount
To Amount Max amount
Transaction From dd/mm/yyyy
Transaction To dd/mm/yyyy
Compliance Status All Compliance Status
Webhook Status All Webhook Status
Txn Status All Status

Table

Column Example
TX ID / Hash TX1001 / 0x7f3d...a8f9
Invoice ID ORD123456789
Customer ID CUST-10101
Amount 1,250.00 USDT
Status Success
Risk Low
Compliance Approved
Timestamp Dec 8, 2024 10:30 AM
Webhook Sent

5.4 Virtual Account Refund Transactions UI


CTA: Initial Refund Transaction
Filters

Field Placeholder / Value
Hot Wallet All Hot Wallets
Original Txn Hash Enter original tx hash
Transaction Hash Enter tx hash
Invoice ID Enter invoice ID
Customer ID Search by Customer ID
Address Search by address
Network All Networks
Assets All Assets
From Amount Min amount
To Amount Max amount
Transaction From dd/mm/yyyy
Transaction To dd/mm/yyyy
Created By All Creators
Webhook Status All Webhook Status
Txn Status All Status

Table

Column Example
Refund Txn Hash 0xa1b2...e1f2
Original Tx 0x7f3d...a8f9
Invoice ID ORD123456789
Customer ID CUST-10101
Amount 320.50 USDT
Created By John Smith
Timestamp Dec 8, 2024 11:20 AM
Webhook Sent
Status Success

5.5 Transaction Details Modal UI

UI Element Description
Title Transaction Details
Status Badge Success / Pending / Failed
Close Icon Close modal
Transaction ID Internal transaction ID with copy icon
Transaction Hash Blockchain tx hash with copy icon
Order ID Order/invoice ID
Merchant Merchant name
Amount Amount and asset
From Address Sender address with copy icon
To Address Receiver address with copy icon
Blockchain Blockchain name
Timestamp Transaction timestamp
Initial Refund Button Red refund CTA if eligible

5.6 Process Refund Modal UI

UI Element Description
Title Process Refund
Description Initiate a partial or full refund for this transaction
Refund Amount Editable numeric input
Receiver Address Refund receiver address
Reason Required reason
Description Optional additional details
Estimated Fee Read-only calculated fee
Cancel Button Closes modal
Confirm Refund Button Submits refund

6. Data Requirements

Webhook dispatcher tables

dead_letter

Field Type Required Description
id Integer No Primary key
consumer String Yes Consumer
event_id String Yes Event id
event_type String Yes Event type
version Integer Yes Version
reason String Yes Decision / rejection reason
body JSON Yes Body
created_at DateTime Yes Created timestamp (UTC)

inbox

Field Type Required Description
consumer String Yes Consumer
event_id String Yes Event id
processed_at DateTime Yes Processed at

inbox_retry

Field Type Required Description
consumer String Yes Consumer
event_id String Yes Event id
attempt Integer Yes Attempt
retry_at DateTime Yes Retry at
reason String Yes Decision / rejection reason
body JSON Yes Body

webhook_delivery_attempt

Field Type Required Description
id Integer No Primary key
job_id Integer Yes Job id
attempt_number Integer Yes Attempt number
status String Yes Lifecycle status (active / inactive / domain-specific values)
http_status Integer No Http status
error String No Error
created_at DateTime Yes Created timestamp (UTC)

webhook_delivery_audit

Field Type Required Description
id Integer No Primary key
actor String Yes Actor
source_event_id String Yes Source event id
created_at DateTime Yes Created timestamp (UTC)

webhook_delivery_job

Field Type Required Description
id Integer No Primary key
merchant_id UUID Yes Owning merchant identifier
payment_id String Yes Payment id
source_event_id String Yes Source event id
delivery_class String Yes Delivery class
event_type String Yes Event type
status String Yes Lifecycle status (active / inactive / domain-specific values)
attempt_count Integer Yes Attempt count
next_retry_at DateTime No Next retry at
body JSON Yes Body
created_at DateTime Yes Created timestamp (UTC)
updated_at DateTime Yes Last updated timestamp (UTC)

Transaction API models (code SoT)

7. API Routes

Method Route Description Request Response
GET /api/v1/transaction/health Liveness {} {status, service}
GET /api/v1/transaction/transactions List transactions {merchant_id?, status?, type?, from?, to?, page?, page_size?} (query) {items[{id, merchant_id, type, status, amount, asset, tx_hash?, created_at, …}], page, page_size, total}
POST /api/v1/transaction/transactions Create transaction {merchant_id, type, amount, asset, …CreateTransactionRequest fields} transaction item payload
PUT /api/v1/transaction/transactions Update transaction {id, status?, …updatable fields} transaction item payload
GET /api/v1/transaction/transactions/{id} Transaction detail {id} detail payload

8. Audit Log Requirements

Action Audit Required Captured Fields
View Transaction Details Optional user, merchant, transaction_id, timestamp
Copy Transaction Hash Optional user, transaction_id, field, timestamp
Open Explorer Optional user, transaction_id, blockchain, network, timestamp
Initiate Refund Yes user, transaction_id, refundable_amount, timestamp
Confirm Refund Yes user, original_transaction_id, refund_amount, receiver_address masked/hash, reason, timestamp
Refund Validation Failed Yes user, transaction_id, failure_reason, timestamp
Refund Broadcasted Yes user, refund_id, refund_hash, source_wallet, timestamp
Refund Failed Yes refund_id, failure_reason, timestamp
Resend Webhook Yes user, transaction_ids, transaction_type, timestamp
Webhook Delivery Result Yes transaction_id, endpoint, response_code, status, timestamp

9. Error Handling

Scenario Expected Behavior
Transaction list fails to load Show error and retry option
No transactions found Show empty state
Invalid amount range Show inline validation
Transaction From > Transaction To Show date range validation error
Transaction not found Show “Transaction not found”
Refund not eligible Show reason and disable refund
Refund amount is 0 or negative Show inline error
Refund amount exceeds remaining amount Block confirmation
Receiver address invalid Show inline error
Estimated fee unavailable Disable confirm and allow retry
Wallet balance insufficient Block refund
User rejects signature Do not create broadcasted refund
Broadcast fails Mark refund as Failed
Webhook resend fails Show failure toast and preserve attempt log
User lacks permission Show access denied

E. ReferencesE. Tham chiếu