A Next.js application for merchant onboarding and configuration management.
- Merchant Onboarding - Complete onboarding form for new merchants
- Merchant Configuration - Configure receiving address and settlement token settings
First, install the dependencies:
npm installThen, run the development server:
npm run devOpen http://localhost:3000 with your browser to see the result.
/app- Next.js App Router pages and components/onboarding- Merchant onboarding page/configuration- Merchant configuration page
/components- Reusable React components (if needed)
- Next.js 14 (App Router)
- TypeScript
- Tailwind CSS
- React 18
/- Home page with navigation to onboarding and configuration/onboarding- Merchant onboarding form/configuration- Merchant list; click Configure to go to/configuration/[merchantId]/configuration/[merchantId]- Configure one merchant (settlement + products)
Data is stored in data/merchants.json. All endpoints expect and return JSON.
Base URL (dev): http://localhost:3000/api
POST /api/merchants
Creates a new merchant. Used when completing onboarding.
Request body:
{
"businessName": "Acme Store",
"email": "hello@acme.com",
"phone": "+1 555 123 4567",
"businessType": "retail",
"website": "https://acme.com",
"description": "Widgets and gadgets",
"receivingAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"settlementToken": "ADI"
}Response: 201 – the created merchant (includes id and createdAt).
{
"id": "1739123456789",
"businessName": "Acme Store",
"email": "hello@acme.com",
"phone": "+1 555 123 4567",
"businessType": "retail",
"website": "https://acme.com",
"description": "Widgets and gadgets",
"receivingAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"settlementToken": "ADI",
"createdAt": "2026-02-19T12:00:00.000Z"
}Example (curl):
curl -X POST http://localhost:3000/api/merchants \
-H "Content-Type: application/json" \
-d '{"businessName":"Acme Store","email":"hello@acme.com","phone":"+1 555 123 4567","businessType":"retail","website":"https://acme.com","description":"Widgets","receivingAddress":"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb","settlementToken":"ADI"}'GET /api/merchants
Returns all merchants (used on the configuration list page).
Response: 200 – array of merchants.
[
{
"id": "1739123456789",
"businessName": "Acme Store",
"email": "hello@acme.com",
"receivingAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"settlementToken": "ADI",
"products": [],
"createdAt": "2026-02-19T12:00:00.000Z"
}
]Example (curl):
curl http://localhost:3000/api/merchantsGET /api/merchants/[id]
Returns a single merchant by ID (e.g. for the configuration detail page).
Response: 200 – the merchant; 404 if not found.
{
"id": "1739123456789",
"businessName": "Acme Store",
"email": "hello@acme.com",
"phone": "+1 555 123 4567",
"businessType": "retail",
"website": "https://acme.com",
"description": "Widgets and gadgets",
"receivingAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"settlementToken": "ADI",
"autoSettlement": false,
"settlementThreshold": "",
"products": [
{
"id": "1739123500000",
"name": "Blue Widget",
"priceUsd": "19.99",
"imageUrl": "https://example.com/widget.jpg"
}
],
"createdAt": "2026-02-19T12:00:00.000Z"
}Example (curl):
curl http://localhost:3000/api/merchants/1739123456789PUT /api/merchants/[id]
Updates a merchant. Used for:
- Configuring settlement (receiving address, settlement token, auto-settlement, threshold)
- Adding/removing products by sending the full
productsarray
Send only the fields you want to update.
Request body (settlement config):
{
"receivingAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"settlementToken": "USDC",
"autoSettlement": true,
"settlementThreshold": "100"
}Request body (add/update products):
{
"products": [
{
"id": "1739123500000",
"name": "Blue Widget",
"priceUsd": "19.99",
"imageUrl": "https://example.com/widget.jpg"
},
{
"id": "1739123600000",
"name": "Red Gadget",
"priceUsd": "29.50",
"imageUrl": ""
}
]
}Response: 200 – the updated merchant; 404 if not found.
Example (curl) – update settlement:
curl -X PUT http://localhost:3000/api/merchants/1739123456789 \
-H "Content-Type: application/json" \
-d '{"receivingAddress":"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb","settlementToken":"USDC","autoSettlement":true,"settlementThreshold":"100"}'Example (curl) – add a product:
curl -X PUT http://localhost:3000/api/merchants/1739123456789 \
-H "Content-Type: application/json" \
-d '{"products":[{"id":"1","name":"Blue Widget","priceUsd":"19.99","imageUrl":"https://example.com/widget.jpg"}]}'