Overview
The RedTab Credit Rating System can use sales data from Crossover POS to enhance credit assessments. This integration works in two ways:
- Merchant ID Reference: Merchants can provide their Crossover POS Merchant ID during the credit assessment process
- Automated Data Sync: Crossover POS can push sales data to the RedTab API
API Endpoints
1. Submit POS Data
Endpoint: POST /api/pos-data
This endpoint allows Crossover POS to submit merchant sales data to the RedTab system.
Request Format
{ "merchantId": "MERCH123456", "dailySales": 15000, "monthlySales": 450000, "customerCount": 120, "averageTicketSize": 1250, "repeatCustomerRate": 0.35, "topSellingItems": ["Chicken Momo", "Chowmein", "Thukpa"], "salesTrend": "growing" }
Required Fields
Field | Type | Description |
---|---|---|
merchantId | string | Unique Crossover POS merchant identifier |
dailySales | number | Average daily sales amount in NPR |
monthlySales | number | Total monthly sales amount in NPR |
customerCount | number | Average number of daily customers |
averageTicketSize | number | Average transaction amount in NPR |
Optional Fields
Field | Type | Description |
---|---|---|
repeatCustomerRate | number | Percentage (0-1) of repeat customers |
topSellingItems | array | List of top selling menu items |
salesTrend | string | One of: "growing", "stable", "declining" |
Response Format
{ "success": true, "message": "POS data saved successfully", "data": { "merchantId": "MERCH123456", "dailySales": 15000, "monthlySales": 450000, "customerCount": 120, "averageTicketSize": 1250, "repeatCustomerRate": 0.35, "topSellingItems": ["Chicken Momo", "Chowmein", "Thukpa"], "salesTrend": "growing", "timestamp": "2023-06-15T08:30:45.123Z" } }
2. Retrieve POS Data
Endpoint: GET /api/pos-data?merchantId=MERCH123456
This endpoint allows retrieving the latest POS data for a specific merchant.
Query Parameters
Parameter | Description |
---|---|
merchantId | Required. The Crossover POS merchant ID |
Response Format
{ "success": true, "data": { "merchantId": "MERCH123456", "dailySales": 15000, "monthlySales": 450000, "customerCount": 120, "averageTicketSize": 1250, "repeatCustomerRate": 0.35, "topSellingItems": ["Chicken Momo", "Chowmein", "Thukpa"], "salesTrend": "growing", "timestamp": "2023-06-15T08:30:45.123Z" } }
Integration Methods
Method 1: Scheduled Data Sync
We recommend implementing a scheduled job that runs daily to sync merchant data:
- For each merchant in your system, collect the relevant sales metrics
- Format the data according to the API specification
- Submit the data to the RedTab API endpoint
- Log the response for verification
Method 2: Real-time Updates
For more timely data, you can implement real-time updates:
- Set up a trigger in your system for significant sales events (e.g., day closing)
- When triggered, collect the updated metrics
- Submit the data to the RedTab API endpoint
Method 3: Batch Updates
For efficiency with many merchants:
- Collect data for multiple merchants
- Submit individual API requests for each merchant
- Process in batches to avoid rate limiting
Authentication
Currently, the API uses IP-based restrictions. Your system's IP addresses must be whitelisted to access the API. Contact RedTab support to have your IPs added to the allowlist.
Future versions will implement token-based authentication.
Example Implementation
Node.js Example
const axios = require('axios'); async function submitPOSData(merchantData) { try { const response = await axios.post('https://api.redtab.xyz/api/pos-data', merchantData); console.log('Data submitted successfully:', response.data); return response.data; } catch (error) { console.error('Error submitting POS data:', error.response?.data || error.message); throw error; } } // Example usage const merchantData = { merchantId: "MERCH123456", dailySales: 15000, monthlySales: 450000, customerCount: 120, averageTicketSize: 1250, repeatCustomerRate: 0.35, topSellingItems: ["Chicken Momo", "Chowmein", "Thukpa"], salesTrend: "growing" }; submitPOSData(merchantData);
Python Example
import requests import json def submit_pos_data(merchant_data): try: response = requests.post('https://api.redtab.xyz/api/pos-data', json=merchant_data) response.raise_for_status() print('Data submitted successfully:', response.json()) return response.json() except requests.exceptions.RequestException as e: print('Error submitting POS data:', e) raise # Example usage merchant_data = { "merchantId": "MERCH123456", "dailySales": 15000, "monthlySales": 450000, "customerCount": 120, "averageTicketSize": 1250, "repeatCustomerRate": 0.35, "topSellingItems": ["Chicken Momo", "Chowmein", "Thukpa"], "salesTrend": "growing" } submit_pos_data(merchant_data)
Testing
You can test the integration using our sandbox environment:
- Sandbox URL:
https://sandbox-api.redtab.xyz/api/pos-data
- Test Merchant IDs:
TEST001
,TEST002
,TEST003
Support
For integration support, please contact:
- Email: integration-support@redtab.xyz
- Phone: +977-1-XXXXXXX
Changelog
- v1.0.0 (2023-06-01): Initial API release
- v1.0.1 (2023-06-15): Added optional fields for enhanced data