Overview
Implement HTTP API server using Echo framework with /verify and /settle endpoints.
Implementation Details
Files:
internal/api/server.go - Server setup
internal/api/handlers.go - Request handlers
internal/api/types.go - Request/Response types
Endpoints
| Method |
Path |
Description |
| POST |
/verify |
Verify payment payload |
| POST |
/settle |
Execute settlement |
| GET |
/health |
Health check |
| GET |
/.well-known/x402-facilitator |
Discovery info |
Request Types
VerifyRequest:
type VerifyRequest struct {
Payload json.RawMessage `json:"payload"`
PaymentRequirements json.RawMessage `json:"paymentRequirements"`
}
SettleRequest:
type SettleRequest struct {
Payload json.RawMessage `json:"payload"`
PaymentRequirements json.RawMessage `json:"paymentRequirements"`
}
Response Types
VerifyResponse:
type VerifyResponse struct {
Valid bool `json:"valid"`
Message string `json:"message,omitempty"`
}
SettleResponse:
type SettleResponse struct {
Success bool `json:"success"`
TxHash string `json:"txHash,omitempty"`
Error string `json:"error,omitempty"`
}
Acceptance Criteria
Dependencies
Branch
feature/api-server
Overview
Implement HTTP API server using Echo framework with
/verifyand/settleendpoints.Implementation Details
Files:
internal/api/server.go- Server setupinternal/api/handlers.go- Request handlersinternal/api/types.go- Request/Response typesEndpoints
/verify/settle/health/.well-known/x402-facilitatorRequest Types
VerifyRequest:
SettleRequest:
Response Types
VerifyResponse:
SettleResponse:
Acceptance Criteria
Dependencies
Branch
feature/api-server