HTTP Sync Target
The HTTP sync target sends price data to any arbitrary HTTP endpoint via POST, PUT, or PATCH. Use this when you need to integrate pricing with a system that does not have a dedicated provider (e.g., a custom API or third-party service).
How It Works
The provider:
- Builds a compact JSON payload with all nFusion prices.
- Adds configured headers (including an optional auth token read from an env var).
- Issues an HTTP request to the configured endpoint using the configured method and timeout.
Configuration Settings
| Setting | Default | Description |
|---|---|---|
endpoint_url | (required) | Full HTTPS URL to POST/PUT/PATCH prices to |
method | POST | HTTP method: POST, PUT, or PATCH |
timeout | 30 | Request timeout in seconds (5–300) |
custom_headers | (optional) | JSON object of additional headers, e.g. {"X-API-Version": "v1"} |
auth_header_env_var | (optional) | Name of the .env var containing the auth token |
auth_header_name | Authorization | Header name for the auth token |
Payload Format
{
"tenant": "Retail",
"tenant_id": 1,
"synced_at": "2026-03-27T10:30:00Z",
"count": 150,
"prices": [
{"s": "SKU-001", "b": 100.50, "a": 105.00, "wb": 95.00, "wa": 99.00},
{"s": "SKU-002", "b": 200.00, "a": 210.00}
]
}
Compact Key Reference
| Key | Full Name | Description |
|---|---|---|
s | SKU | Product identifier |
b | Bid | Bid price |
a | Ask | Ask price |
wb | Wholesale Bid | Wholesale bid |
wa | Wholesale Ask | Wholesale ask |
Authentication
Set the token in .env:
HTTP_SYNC_AUTH_TOKEN="Bearer my-token-here"
In the sync target settings:
- Auth Header Env Var:
HTTP_SYNC_AUTH_TOKEN - Auth Header Name:
Authorization
The provider will include Authorization: Bearer my-token-here in every request automatically.
Example Receiving Endpoint (PHP)
<?php
header('Content-Type: application/json');
$auth = $_SERVER['HTTP_AUTHORIZATION'] ?? '';
if ($auth !== 'Bearer ' . getenv('API_SECRET_TOKEN')) {
http_response_code(401);
echo json_encode(['error' => 'Unauthorized']);
exit;
}
$data = json_decode(file_get_contents('php://input'), true);
foreach ($data['prices'] as $price) {
$sku = $price['s'];
$ask = $price['a'];
// update your system...
}
http_response_code(200);
echo json_encode(['success' => true, 'processed' => count($data['prices'])]);
Key File
app/SyncTargets/Http/HttpSyncTargetProvider.php