Admin CRM — Merchant

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

Doc IDCPG-CRM_FSD_Merchant
VersionPhiên bản1.2
StatusTrạng tháiDraft
OwnerCPG BA / Architecture
AudienceĐối tượngFrontend, Backend, FlyPay Support, QA, Product
ClassificationPhân loạiInternal
Effective dateNgày hiệu lực02/12/2026
Related docs Admin CRM FSD · 02A Merchant · Account FSD (BW/VA)

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

Version Date Author ChangesThay đổi
1.2 02/12/2026 Khoa Trinh Version 1.2

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

D. ContentD. Nội dung

1. Module Scope

The Merchant Management Module is responsible for managing the full lifecycle of merchants on the Payment Gateway platform. It allows system administrators and internal operators to onboard, review, configure, monitor, and maintain merchants, including:

  • Merchant onboarding and profile management

  • Document management and KYC verification (manual & provider-based)

  • Payment service registration and fee configuration

  • Security parameters (IP whitelist, API keys, webhooks)

  • Merchant activation, suspension, and operational control

Out of scope (Account module): Beneficiary Accounts (BW), Virtual Accounts (VA), Hot Wallet lifecycle — see CPG-CRM_FSD_Account / 02A Account.

This module serves as the core operational control layer for merchant-related activities.

2. User Roles

Role Name Description Permissions
System Administrator Full system access Create, edit, suspend merchants; manage all configurations
Merchant Support Business owner of merchant Create, edit, suspend merchants
Compliance Officer KYC & compliance reviewer Review and approve KYC, documents
Finance Manager Financial controller Approve fee configurations, settlement parameters

3. Functional Requirements

3.1 Features

  • Display paginated list of merchants
  • Search by Merchant ID or Merchant Name
  • Filter by:
  • Business Type
  • Merchant Status
  • KYC Status
  • Tier
  • Assigned Manager / Support
  • View summary information:
  • Merchant ID
  • Name
  • Business Type
  • Tier
  • KYC Status
  • Status
  • Created Date

3.1.2 General Information Management

  • View and edit merchant core information
  • Fields include:
  • Merchant ID (read-only)
  • Business Name
  • Business Type
  • Tier
  • Business Address
  • Contact Person
  • Contact Email
  • Contact Phone
  • Tax ID
  • Assigned Manager
  • Assigned Supporter
  • Ability to suspend / unsuspend merchant
  • Changes are audit-logged

3.1.3 Document Management

  • Upload merchant-related documents
  • Supported document types:
  • Business License
  • Tax Registration Certificate
  • Identity Document
  • Bank Statement
  • Proof of Address
  • File validation:
  • Max 5 files per upload
  • Max 10MB per file
  • Allowed formats: PDF, DOC, DOCX, JPG, PNG, XLS, XLSX
  • View, edit notes, and delete documents
  • Track uploader (Merchant/Admin)

3.1.4 KYC Management – Manual

  • Manual entry of KYC information:
  • Personal Information
  • Business Information
  • Address Information
  • Verification checklists:
  • Identity Verification
  • Address Verification
  • Business Verification
  • Manual approval and status assignment

3.1.5 KYC Management – Provider (KYC-chain)

  • Integration with external KYC provider
  • Display provider verification status
  • Actions:
  • Request KYC
  • Sync Status
  • Reset Verification
  • Display verification timeline
  • Store provider verification ID and sync timestamp

3.1.6 Payment Services Registration

  • Register services based on merchant tier
  • Service categories:
  • Crypto QR Payment
  • Crypto Checkout Link
  • Card Payment
  • Wire Transfer
  • Subscription Billing
  • Enable/disable services per merchant

3.1.7 Fee & Settlement Configuration

  • Configure service-level fees:

  • Transaction Fee (%)

  • Fixed Fee

  • Monthly Fee

  • Settlement Period

  • Chargeback Fees

  • Support default vs custom fee values

  • Finance approval workflow:

  • Pending Approval

  • Approved

  • Fee summary preview

3.1.8 Parameters & Security Settings

IP Whitelist

  • Add / remove allowed IP addresses
  • Enable / disable IP entries

API Keys

  • View merchant API keys
  • Revoke keys (no regeneration here)

Webhooks

  • Manage webhook endpoints
  • Assign events:
  • payment.success
  • payment.failed
  • refund.initiated
  • refund.completed
  • Enable / disable webhooks

3.2 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:

4. User Interface

  • Merchant List page with search & filters

  • Edit Merchant page with tab navigation:
  • General Information

  • Documents

  • KYC Manual

  • KYC via Provider

  • Payment Services

  • Parameters

  • Modal dialogs for:
  • Add Document
  • Add IP Address
  • Add Webhook
  • Status indicators with color coding
  • Inline validation messages

5. Data Requirements

5.1 Data Dictionary

merchant_configs

Field Type Required Description
merchant_id UUID No Owning merchant identifier
tax_mode String Yes Tax calculation mode
tax_jurisdiction String Yes Tax jurisdiction
tax_type String Yes Tax type
tax_code String Yes Tax code
tax_rate Decimal Yes Tax rate
created_by String Yes Creator user id
updated_by String Yes Last updater user id
created_at DateTime Yes Created timestamp (UTC)
updated_at DateTime Yes Last updated timestamp (UTC)

merchant_documents

Field Type Required Description
id UUID No Primary key
merchant_id UUID Yes Owning merchant identifier
document_type String Yes Document type key
file_name String Yes Stored file name
file_url String Yes Document/file URL
mime_type String Yes MIME type
file_size Integer Yes File size in bytes
notes String Yes Free-text notes
uploaded_by String Yes Uploader user id
uploaded_at DateTime Yes Upload timestamp
is_deleted Boolean Yes Soft-delete flag
deleted_at DateTime No Soft-delete timestamp
file_id UUID No File-service object id
sumsub_doc_type String No Sumsub document type mapping

merchant_kyc_decisions

Field Type Required Description
id UUID No Primary key
merchant_id UUID Yes Owning merchant identifier
source String Yes KYC decision source (manual / sumsub)
status String Yes Lifecycle status (active / inactive / domain-specific values)
reason String No Decision / rejection reason
decided_by String Yes Decision actor id
decided_at DateTime Yes Decision timestamp
created_at DateTime Yes Created timestamp (UTC)

merchant_kyc_manual

Field Type Required Description
merchant_id UUID No Owning merchant identifier
full_name String Yes Full legal name
date_of_birth DATE No Date of birth
nationality String Yes Nationality
id_type String Yes ID document type
id_number String Yes ID document number
id_expiry_date DATE No ID expiry date
business_registration_number String Yes Business registration number
business_registration_date DATE No Business registration date
business_license_number String Yes Business license number
residential_address String Yes Residential address
city String Yes City
state String Yes State / province
postal_code String Yes Postal code
country String Yes Country
identity_verified Boolean Yes Identity verification flag
address_verified Boolean Yes Address verification flag
business_verified Boolean Yes Business verification flag
updated_by String Yes Last updater user id
updated_at DateTime Yes Last updated timestamp (UTC)
status String Yes Lifecycle status (active / inactive / domain-specific values)

merchant_kyc_provider

Field Type Required Description
merchant_id UUID No Owning merchant identifier
provider_name String Yes Provider name
applicant_id String Yes Applicant id
inspection_id String Yes Inspection id
review_status String Yes Review status
review_answer String No Review answer
reject_type String No Reject type
reject_labels JSON Yes Reject labels
provider_status String Yes Provider status
hosted_url String No Hosted url
hosted_url_expires_at DateTime No Hosted url expires at
raw_response JSON Yes Raw response
last_synced_at DateTime No Last synced at
updated_at DateTime Yes Last updated timestamp (UTC)

merchant_payment_services

Field Type Required Description
merchant_id UUID Yes Owning merchant identifier
payment_service_id UUID Yes Payment service id
created_at DateTime Yes Created timestamp (UTC)

merchant_roles

Field Type Required Description
id Integer No Primary key
merchant_id UUID Yes Owning merchant identifier
name String Yes Display name
description String No Text description
permission_matrix JSON Yes Permission matrix
status String Yes Lifecycle status (active / inactive / domain-specific values)
created_at DateTime Yes Created timestamp (UTC)
updated_at DateTime Yes Last updated timestamp (UTC)

merchant_service_fee_configs

Field Type Required Description
id UUID No Primary key
merchant_id UUID Yes Owning merchant identifier
service_id UUID Yes Payment / product service identifier
tx_fee_wallet String Yes Tx fee wallet
settlement_fee_wallet String Yes Settlement fee wallet
vat_wallet String Yes Vat wallet
operator String Yes Operator
settlement_manager String Yes Settlement manager
signers JSON Yes Signers
fee_tokens JSON Yes Fee tokens
fee_schedules JSON Yes Fee schedules
enabled Boolean Yes Feature enabled flag
created_at DateTime Yes Created timestamp (UTC)
updated_at DateTime Yes Last updated timestamp (UTC)

merchant_tiers

Field Type Required Description
id UUID No Primary key
name String Yes Display name
description String No Text description
status String Yes Lifecycle status (active / inactive / domain-specific values)
valid_from DateTime No Valid from
max_accounts Integer Yes Max accounts
fee_structure JSON Yes Fee structure
rate_limiting JSON Yes Rate limiting
approved_by String No Approved by
approved_at DateTime No Approved at
rejected_by String No Rejected by
rejected_at DateTime No Rejected at
rejection_reason String No Rejection reason
created_at DateTime Yes Created timestamp (UTC)
updated_at DateTime Yes Last updated timestamp (UTC)
settlement_period String Yes Settlement period

merchant_users

Field Type Required Description
id UUID No Primary key
merchant_id UUID Yes Owning merchant identifier
merchant_role_id Integer Yes Merchant role id
email String Yes Email address
password_hash String Yes Password hash (never expose in API)
name String Yes Display name
status String Yes Lifecycle status (active / inactive / domain-specific values)
created_at DateTime Yes Created timestamp (UTC)
updated_at DateTime Yes Last updated timestamp (UTC)

merchants

Field Type Required Description
id UUID No Primary key
merchant_id String Yes Owning merchant identifier
business_name String Yes Business name
business_address String Yes Business address
contact_email String Yes Contact email
tax_id String Yes Tax id
manager_id String Yes Manager id
manager_name String Yes Manager name
contact_person String Yes Contact person
contact_phone String Yes Contact phone
supporter_id String Yes Supporter id
supporter_name String Yes Supporter name
status String Yes Merchant status (draft / pending / active / rejected / suspended)
kyc_status String Yes Kyc status
created_by String Yes Creator user id
updated_by String Yes Last updater user id
created_at DateTime Yes Created timestamp (UTC)
updated_at DateTime Yes Last updated timestamp (UTC)
tier UUID No Custody / merchant tier label
business_type UUID No Business type
cobo_vault_id String No Cobo vault identifier

webhook_setting_audits

Field Type Required Description
id Integer No Primary key
merchant_id UUID Yes Owning merchant identifier
actor String Yes Actor
url_hash String Yes Url hash
subscriptions String Yes Subscriptions
created_at DateTime Yes Created timestamp (UTC)

webhook_settings

Field Type Required Description
merchant_id UUID No Owning merchant identifier
url String Yes Url
enabled Boolean Yes Feature enabled flag
timeout_seconds Integer Yes Timeout seconds
retry_attempts Integer Yes Retry attempts
retry_delay_seconds Integer Yes Retry delay seconds
events String Yes Subscribed webhook event types
secret_version Integer Yes Secret version
previous_secret_version Integer No Previous secret version
created_at DateTime Yes Created timestamp (UTC)
updated_at DateTime Yes Last updated timestamp (UTC)

6. API Routes

Method Route Description Request Response
GET /health Liveness {} {status}
POST /api/v1/public/kyc/sumsub/webhook Sumsub KYC webhook {Sumsub event fields…} + HMAC headers {ok}
GET /api/v1/merchant/tiers/ List tiers {page?, limit?} (query) {items[{id, name, status, …}]}
POST /api/v1/merchant/tiers/ Create tier {name, …tier fields} {id, name, status, …}
GET /api/v1/merchant/tiers/{id} Get tier {id} tier payload
PUT /api/v1/merchant/tiers/{id} Update tier {name?, …tier fields} tier payload
DELETE /api/v1/merchant/tiers/{id} Delete tier {id} {}
POST /api/v1/merchant/tiers/{id}/submit Submit tier {id} tier payload
POST /api/v1/merchant/tiers/{id}/approve Approve tier {id, reason?} tier payload
POST /api/v1/merchant/tiers/{id}/reject Reject tier {id, reason} tier payload
GET /api/v1/merchant/config Get own merchant config {} {id, merchant_id, merchant_name, merchant_address, tax_id, payment_services[], tax[{tax_mode, tax_jurisdiction, tax_type, tax_code, tax_rate}]}
POST/PUT /api/v1/merchant/config Create/update config {tax_mode, tax_jurisdiction, tax_type, tax_code, tax_rate, …} config payload
GET /api/v1/merchant/settings/webhook Get webhook settings {} {webhook_url, enabled, events[], secret_masked?}
PUT /api/v1/merchant/settings/webhook Update webhook settings {webhook_url, enabled, events[]} webhook settings payload
POST /api/v1/merchant/settings/webhook/test Test webhook {} {ok, status_code?, error?}
POST /api/v1/merchant/settings/webhook/secret/rotate Rotate webhook secret {} {webhook_url, enabled, events[], secret}
GET /api/v1/merchant/{merchant_id}/services/{merchant_service_id} Fee config {merchant_id, merchant_service_id} {merchant_id, service_id, tx_bps, settlement_bps, vat_bps, fixed_*, enabled, …}
GET /internal/v1/merchants/{merchant_id}/services/{merchant_service_id} Internal fee config {merchant_id, merchant_service_id} + X-Internal-Secret fee config payload
GET /api/v1/merchants/ List merchants {page?, limit?, status?, search?} (query) {items[{id, business_name, status, kyc_status, tier, …}], page, limit, total}
POST /api/v1/merchants/ Create merchant {password?, business_name, business_type, business_address, contact_email, tax_id?, manager_id?, manager_name?, tier?, contact_person?, contact_phone?, supporter_id?, supporter_name?, status?, kyc_status?, payment_service_ids[]} merchant payload
GET /api/v1/merchants/{id} Get merchant {id} merchant payload
PUT /api/v1/merchants/{id} Update merchant same fields as create (partial) merchant payload
PATCH /api/v1/merchants/{id}/status Patch merchant status {status} {id, status}
POST /api/v1/merchants/{id}/cobo-vault Generate Cobo vault {id} {merchant_id, cobo_vault_id, …}
GET /api/v1/merchants/{id}/documents List documents {id} {items[{id, document_type, file_name, file_url, mime_type, file_size, …}]}
POST /api/v1/merchants/{id}/documents Upload document multipart[file, document_type, notes?] document payload
PUT /api/v1/merchants/{id}/documents/{documentId} Update document metadata {document_type?, notes?} document payload
DELETE /api/v1/merchants/{id}/documents/{documentId} Delete document {id, documentId} {}
GET /api/v1/merchants/{id}/kyc Get KYC state {id} {manual?, provider?, decisions[], status}
PUT /api/v1/merchants/{id}/kyc/manual-profile Save manual KYC profile {full_name, date_of_birth?, nationality, id_type, id_number, …address fields, verification flags} KYC payload
POST /api/v1/merchants/{id}/kyc/manual-review Manual KYC review {status, reason?} KYC payload
POST /api/v1/merchants/{id}/kyc/sumsub/initiate Start Sumsub {level?, …} {applicant_id?, url?, …}
POST /api/v1/merchants/{id}/kyc/sumsub/request-link Request Sumsub link {} {url, expires_at?}
GET /api/v1/merchants/{id}/kyc/sumsub/status Sumsub status {id} {status, review_result?, …}
GET/POST /api/v1/merchants/business-types List/create business types {name, status?} on POST type list/item
PUT/PATCH /api/v1/merchants/business-types/{id} Update / status business type {name?} / {status} type payload
GET/POST /api/v1/merchants/document-types List/create document types {name, status?} on POST type list/item
PUT/PATCH /api/v1/merchants/document-types/{id} Update / status document type {name?} / {status} type payload

7. Merchant Onboarding Flow

7.1 Actors & Systems

Actor / System Responsibility
Merchant (Website) Submit inquiry, verify email
Merchant (Portal) Complete onboarding, upload documents, select services
Merchant Support (CRM) Lead qualification, onboarding support
Compliance Officer (CRM) KYC review and approval
Finance Manager (CRM) Custom fee approval
KYC Provider External or manual identity verification

7.2 Merchant Status Model

Status Description
NEW Inquiry submitted, not yet verified
PENDING_REVIEW Email verified, onboarding started
KYC_APPROVED KYC approved by Compliance
PENDING_FINANCE_APPROVAL Awaiting finance approval for custom fees
ACTIVE Merchant fully onboarded and live
NOT_QUALIFIED Inquiry rejected at pre-screening

7.3 Flow 1 – Merchant Inquiry & Lead Qualification

Trigger
Merchant initiates onboarding on Website.
Steps

  1. Merchant opens Inquiry Page.
  2. The merchant enters general business information.
  3. Merchant submits inquiry.

System Actions

  1. The system creates inquiry records.
  2. Merchant Support reviews inquiry.

Decision: Qualified Lead?

  • No
  • Merchant marked as NOT_QUALIFIED
  • Flow ends
  • Yes
  • System creates temporary merchant record
  • Merchant status set to NEW
  • Verification email sent

7.4 Flow 2 – Email Verification & Portal Access

Trigger
The merchant receives a verification email.
Steps

  1. Merchant clicks verification link.
  2. The system verifies email.

System Actions

  1. Merchant status updated to PENDING_REVIEW.
  2. The merchant is allowed to log in to Merchant Portal.
  3. Onboarding Wizard is launched automatically on first login.

7.5 Flow 3 – KYC Initiation

Trigger
Merchant enters onboarding wizard.
Steps

  1. Merchant initiates KYC process.

Decision: Manual KYC?

  • Yes
  • Compliance Officer sends manual KYC link to merchant
  • No
  • Merchant proceeds with standard KYC flow

System Actions

  1. Merchant KYC process starts (manual or provider-based).

7.6 Flow 4 – Merchant Onboarding Data Completion

Trigger
Merchant has portal access and KYC is initiated.
Steps (Merchant Portal)

  1. The merchant fills company information.
  2. Merchant uploads business & identity documents.
  3. Merchant selects requested services (QR, Link, APIs, etc.).
  4. The merchant submits an onboarding ticket.

System Actions

  1. System notifies:
    * Merchant Support
    * Compliance Officer

7.7 Flow 5 – Compliance Review & KYC Approval

Trigger
Onboarding ticket submitted.
Steps

  1. Compliance Officer reviews:
    * Merchant application
    * Uploaded documents
    * KYC data

Decision: Approved?

  • No
  • Compliance requests additional documents / clarification
  • Merchant updates data in Portal
  • Flow returns to Flow 4
  • Yes
  • Merchant status set to KYC_APPROVED

7.8 Flow 6 – Fee Structure Configuration

Trigger
Merchant reaches KYC_APPROVED.
Steps

  1. Compliance Officer initiates fee structure setup.

Decision: Use Default Fee Structure?

  • Yes
  • Default fees applied
  • No
  • Merchant status set to PENDING_FINANCE_APPROVAL
  • Custom fee proposal sent to Finance Manager

7.9 Flow 7 – Finance Approval (Custom Fees Only)

Trigger
Merchant status \= PENDING_FINANCE_APPROVAL.
Steps

  1. Finance Manager reviews custom fee structure.

Decision: Approved?

  • No
  • Rejected configuration returned for adjustment
  • Flow returns to Flow 6
  • Yes
  • Custom fee structure applied

7.10 Flow 8 – Merchant Activation

Trigger
Fee structure finalized (default or approved custom).
System Actions

  1. Merchant status set to ACTIVE.
  2. Approval notification email sent to merchant.

7.11 Flow 9 – Post-Activation Setup

Trigger
Merchant status \= ACTIVE.
Steps (Merchant Portal)

  1. Merchant logs in.
  2. Merchant configures:
    * API keys
    * Webhooks
    * Settlement / wallet accounts via Account module (not Merchant tabs)

End State

  1. Onboarding marked as Completed.

7.12 Exception & Loop Handling

Scenario System Behavior
Lead rejected Flow terminates early
Missing documents Loop back to merchant
KYC rejected Loop until approved
Fee rejected Loop until finance approval
Merchant abandons Status remains PENDING_REVIEW

7.13 Key Control & Audit Points

  • Lead qualification decision
  • KYC approval/rejection
  • Fee structure approval
  • Status transitions
  • All decisions must be logged with:
  • Actor
  • Timestamp
  • Reason (where applicable)

E. ReferencesE. Tham chiếu