Overview
Merchant endpoints handle merchant registration and public merchant information lookup.Endpoints
Get Merchant by Address
Lookup merchant information by Sui address (public endpoint).Path Parameters
The merchant’s Sui address (66-character hex with
0x prefix)Response
Merchant display name
Merchant’s public key (64-character hex)
Merchant’s Sui address
Merchant’s decentralized identifier (DID)
Example Request
Example Response
Error Responses
404 Not Found
Merchant with the specified address does not exist
Register Merchant
Register a new merchant and receive an API key (public endpoint).Request Body
Merchant display name (1-255 characters)
Merchant’s Sui address (66-character hex with
0x prefix)Merchant’s hostname (1-255 characters, must be unique)
Merchant’s public key (64-character lowercase hex)
Response
Generated merchant UUID
Merchant’s decentralized identifier
API key for authenticated endpoints (shown only once)
Example Request
Example Response
Error Responses
Implementation Details
Registration Flow
When a merchant registers (seeroutes/merchants.ts:35-83):
- Validate Input: Check required fields and formats
- Check Uniqueness: Verify hostname is not already registered
- Generate Credentials:
- UUID for merchant ID
- DID:
did:identipay:{hostname}:{id} - API key (random secure string)
- API key hash (SHA-256)
- On-Chain Registration: Call
suiService.registerMerchantOnChain()to register in the trust registry - Database Storage: Store merchant info with hashed API key
- Return Response: Return ID, DID, and plain-text API key
Security
- API keys are hashed using SHA-256 before storage
- Only the hash is stored in the database
- The plain-text API key is never retrievable after initial registration
DID Format
Merchant DIDs follow the pattern:Related Endpoints
- Proposals - Create payment proposals (requires API key)
- Transactions - Check transaction status (requires API key)
