Receipt API Integration
Real-time monitoring of the Fujitsu Receipt API (Azure App Service) that processes invoicing for store purchases. Deployed on fujitsu-pt-gdc-dx-integration.com domain with separate dev and production environments.
System Overview
Section titled “System Overview”Azure App Service
Receipt API DEV
dev-elior-stmicro-ba
Receipt API PROD
prd-elior-stmicro-ba
→
GET /hw
CF Worker cron-stats
Health Polling
*/15 * * * *
→
INSERT
Control Center
D1 Database
receipt_api_healthreceipt_api_requests
Operations Dashboard
Real-time Metrics (PROD only)
Receipt API PROD
→
MetricsService.Log()
→
POST /api/receipt-api/logs
→
D1 Database
Azure (DEV + PROD) → Cron Worker → D1 → Dashboard | PROD also sends real-time metrics via MetricsService.Log()
Endpoints
Section titled “Endpoints”| Environment | URL | Purpose | Polled By |
|---|---|---|---|
| DEV | dev-elior-stmicro-ba.fujitsu-pt-gdc-dx-integration.com | Development/testing | Cron Worker (every 15min) |
| PROD | prd-elior-stmicro-ba.fujitsu-pt-gdc-dx-integration.com | Production (live store) | Cron Worker (every 15min) |
Data Flow: Health Monitoring
Section titled “Data Flow: Health Monitoring”Cron Trigger
*/15 * * * *
→
Fetch GET /hw
→
Parse response
→
INSERT into
receipt_api_health
→
Dashboard
Shows status
Data Flow: Request Metrics
Section titled “Data Flow: Request Metrics”User exits store
→
Receipt API
Processes receipt
→
MetricsService.Log()
→
POST
/api/receipt-api/logs
→
Stored in D1
→
Dashboard analytics
Database Schema
Section titled “Database Schema”receipt_api_health
| Column | Type | Description |
|---|---|---|
id | INTEGER | Primary key |
online | INTEGER | 1 = up, 0 = down |
environment | TEXT | ”Development” or “Production” |
build_version | TEXT | Assembly version from /hw |
response_time_ms | REAL | Latency in milliseconds |
error | TEXT | Error message if offline |
created_at | DATETIME | Snapshot timestamp |
receipt_api_requests
| Column | Type | Description |
|---|---|---|
id | INTEGER | Primary key |
user_token | TEXT | User identifier |
cart_id | TEXT | Zippin cart session ID |
success | INTEGER | 1 = success, 0 = failure |
http_status | INTEGER | HTTP response code |
latency_total_ms | REAL | Total processing time |
latency_jes_ms | REAL | JES API call time only |
error_type | TEXT | jes_api_error, network_error, missing_sku, etc. |
error_code | INTEGER | JES error code (e.g., 60110) |
error_message | TEXT | Detailed error message |
payload_items_count | INTEGER | Number of items in cart |
created_at | DATETIME | Request timestamp |
Dashboard Metrics
Section titled “Dashboard Metrics”The Operations page displays real-time analytics for the Receipt API:
- Health Status: Online/Offline badge for dev and prod environments
- Success Rate: Percentage of successful receipts (last 24h)
- Average Latency: Mean response time in milliseconds
- Error Breakdown: Count by error type (JES API errors, network errors, missing SKUs, conversion errors)
- Recent Failures: Table showing last 50 failed requests with cart ID, error type, and message
Error Types Reference
Section titled “Error Types Reference”| Error Type | Description | Example Scenario |
|---|---|---|
jes_api_error | JES API returned an error | Receipt rejected by JES, validation fails |
network_error | Cannot reach JES API | Timeout, DNS failure, connection refused |
missing_sku | Product SKU not found | Unknown item scanned by Zippin system |
conversion_error | Data transformation failed | Invalid price format, null reference exception |
invalid_payload | Request validation failed | Missing required fields, malformed JSON |
Implementation Details
Section titled “Implementation Details”Monitoring Best Practices
Section titled “Monitoring Best Practices”- Health Checks: 15-minute interval prevents rate limiting while providing timely alerts
- Real-time Push: Receipt API sends metrics immediately after processing for instant visibility
- No Local Storage: Azure App Service remains stateless, all data stored in Control Center D1
- Error Classification: Standardized error types enable trend analysis and root cause identification
- Dual Environment: Separate dev/prod monitoring prevents test data from polluting production metrics