Adding New Merchants
Learn how to add new merchants to the FinMatch platform using the Add Merchant form.
Accessing the Form
- Navigate to the Merchants page in the Admin Dashboard
- Click the "+ Add Merchant" button in the top right corner of the merchants table
- The "Add New Merchant" modal will open
Form Fields
Company Name *
- Required: Yes
- Purpose: The merchant's company name
- Saved to:
merchants.json→profiles[merchantId].merchantNameandprofiles[merchantId].companyName - Example: "Acme Corporation"
Domain *
- Required: Yes
- Purpose: The merchant's website domain
- Format: Enter host only (recommended), e.g.
merchant.com - Auto-normalization:
https:///http://is optional in inputwww.is stripped- path/query fragments are removed
- saved format is canonical
https://merchant.com
- Validation: Must be a valid domain or URL
- Saved to:
merchants.json→profiles[merchantId].domain - Example:
- Enter:
merchant.com→ Saved as:https://merchant.com - Enter:
https://www.merchant.com/shop→ Saved as:https://merchant.com
- Enter:
Testing domain
- Required: No
- Purpose: Optional test/sandbox domain for this merchant
- Format: Enter host only (recommended), e.g.
merchant.com - Auto-normalization: Same normalization rules as Domain
- Saved to:
merchants.json→profiles[merchantId].testing_domainmerchant-router.json→[merchantId].testing_domain
- CORS behavior: When set, this domain is auto-whitelisted alongside the primary domain
The form shows https://example.com as a placeholder (in grey text). This is just a hint - you can enter:
example.com(will be normalized tohttps://example.com)https://example.com(used as-is)http://example.com(used as-is, though HTTPS is recommended)
If the domain doesn't match the validation pattern, you'll receive an error message: "Domain must be a valid URL starting with http:// or https://"
Company Number
- Required: No
- Purpose: UK company registration number
- Saved to:
merchants.json→profiles[merchantId].companyNo - Example: "12345678"
Environment
- Required: No (defaults to Production)
- Purpose: Determines which environment the merchant uses (Test, Staging, or Production)
- Options:
- Production (
p) - Live merchant website - Staging (
s) - Staging/test environment - Test (
t) - Development/testing
- Production (
- Saved to:
merchants.json→profiles[merchantId].environmentmerchant-router.json→[merchantId].environment
- Default: Production (
p)
What Happens When You Submit
When you click "Add Merchant", the following happens:
-
Form Validation
- Company Name and Domain are validated
- Domain is normalized (https:// added if missing)
- Domain format is validated against regex pattern
-
API Request
- Data is sent to
POST /api/merchantsendpoint - Merchant API processes the request
- Data is sent to
-
Merchant ID Generation
- A unique FinMatch ID is generated using the current format:
M******(6 digits) - Current format example:
M290756 - Legacy format (still supported for existing merchants):
FM-XXXX-XXXX-XXXX - Legacy format example:
FM-0294-8617-5039
- A unique FinMatch ID is generated using the current format:
-
Data Storage
- Merchant profile is added to
merchants.jsonin Google Cloud Storage - Merchant entry is added to
merchant-router.jsonfor domain routing - Primary domain and optional testing domain are synced to router metadata
- CORS whitelist is updated automatically for both domains (base +
wwworigins) - Status is set to
pendingby default
- Merchant profile is added to
-
Success Response
- Modal closes
- Success message displays: "Merchant '[Company Name]' created successfully! ID: M******"
- Merchants table automatically refreshes to show the new merchant
-
Merchant User Provisioning (Auth)
- Admin flow also provisions/repairs a merchant auth user in
auth-credentials.json - Provisioned user is role
merchantwithapi:finance_assistantpermission and a generated API key - If provisioning fails, merchant creation may still have succeeded; the UI shows an explicit reconciliation warning
- Admin flow also provisions/repairs a merchant auth user in
Field Mapping Reference
| Form Field | JSON Path | Router Path | Notes |
|---|---|---|---|
| Company Name | profiles[merchantId].merchantNameprofiles[merchantId].companyName | N/A | Stored in both fields |
| Domain | profiles[merchantId].domain | [merchantId].domain | Canonical https://host |
| Testing domain | profiles[merchantId].testing_domain | [merchantId].testing_domain | Optional, same normalization |
| Company Number | profiles[merchantId].companyNo | N/A | Optional field |
| Environment | profiles[merchantId].environment | [merchantId].environment | Default: 'p' |
| FinMatch ID | profiles[merchantId].finmatchId | N/A | Auto-generated |
| Status | profiles[merchantId].status | N/A | Default: 'pending' |
| Created At | profiles[merchantId].createdAt | N/A | ISO timestamp |
| Last Updated | profiles[merchantId].lastUpdated | N/A | ISO timestamp |
What Does NOT Happen Automatically
The following actions are NOT performed automatically when creating a merchant:
- ❌ Snippet Deployment Check - The monitor service does NOT automatically check if the snippet is deployed. Deployment status is checked when you view the merchants page or manually trigger a check
- ❌ Stripe Connection - No Stripe customer is automatically linked. You must manually link a Stripe customer after creation
Merchant ID Change Safety (Critical)
Merchant ID edits are migration operations, not normal field edits.
- The old ID and new ID must be reconciled across:
merchants.jsonprofile keysmerchant-router.jsonmapping keys- environment
finmatch-merchant-config.jsonmerchant entries - merchant auth-user mappings (
merchantId+ username)
- If any required env config update fails, the ID change should be treated as failed and rolled back where possible.
- Never manually edit only one location for an ID change; this causes config drift and can orphan lender settings.
Merchant History / Audit Requirements
All merchant profile updates must write a merchant history event.
- Required event actor metadata:
actor_type:admin_userorautomationactor_id/actor_namechange_sourceand endpoint context- timestamp and (when available) correlation ID
- This applies to both dashboard edits and automated sync/ingestion jobs.
Error Handling
Common Errors
"Company name is required"
- Solution: Enter a company name in the Company Name field
"Domain is required"
- Solution: Enter a domain in the Domain field
"Domain must be a valid domain or URL (e.g., merchant.com)"
- Solution: Enter a valid host or URL (e.g.,
merchant.com,https://merchant.com)
"Failed to create merchant"
- Solution: Check network connection, verify API is accessible, check browser console for details
Best Practices
- Use Full Domains - Enter complete domain names (e.g.,
example.comnot justexample) - Verify Domain Format - Ensure domains are valid URLs before submitting
- Set Correct Environment - Use Test/Staging for development, Production for live merchants
- Add Company Number When Available - Helps with merchant identification and CreditSafe integration
- Link Stripe After Creation - Create the merchant first, then link the Stripe customer
Next Steps
After creating a merchant:
- Edit the Merchant - Update any fields or link a Stripe customer
- View Merchant Details - See full merchant information
- Check Deployment Status - Verify if the FinMatch snippet is deployed
- Link Stripe Customer - Connect billing information
Related Documentation
- Merchant Creation Architecture - Developer guide to what happens behind the scenes
- Editing Merchants - How to update merchant information
- Managing Merchants - General merchant management guide
- Merchant Users And Finance Assistant Keys - Identity/key lifecycle and reconciliation rules