Bulk Upload Chargebacks
Upload a CSV or Excel file to create multiple chargebacks in a single batch operation.
POST
https://api.zenpayz.com/merchant/api/v1/chargebacks/bulkBearer · API key
Request
Headers
| Header | Description |
|---|---|
Authorization REQUIRED | Bearer {api_key} |
X-Signature REQUIRED | HMAC-SHA256 signature |
X-Timestamp REQUIRED | ISO 8601 timestamp |
X-Secret-Salt REQUIRED | Secret salt for HMAC validation |
Content-Type REQUIRED | multipart/form-data |
X-Merchant-Id REQUIRED | Merchant identifier |
X-Request-Id REQUIRED | Unique request identifier |
Body Parameters
| Parameter | Type | Description |
|---|---|---|
file REQUIRED | File | CSV or Excel file containing chargeback records (max 10MB) |
webhookUrl OPTIONAL | string | URL to receive a webhook notification when processing completes |
Accepted File Types
| MIME Type | Extension |
|---|---|
text/csv | .csv |
application/vnd.ms-excel | .xls |
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | .xlsx |
Response
Success (200 OK)
{
"success": true,
"data": {
"batchId": "batch_a1b2c3d4e5f6g7h8",
"status": "processing",
"totalRecords": 150,
"processedRecords": 0,
"failedRecords": 0,
"createdAt": "2024-01-15T10:30:00.000Z"
},
"message": "Bulk upload accepted for processing",
"error": null,
"meta": {
"request_id": "req_xxxxx",
"timestamp": "2024-01-15T10:30:00.000Z",
"processing_time_ms": 120,
"api_version": "v1",
"endpoint": "POST /chargebacks/bulk",
"user_type": "merchant"
}
}
Error Responses
| Code | HTTP | Message |
|---|---|---|
| VALIDATION_ERROR | 400 | Invalid file format or missing required file |
| UNAUTHORIZED | 401 | Invalid API key |
| FILE_TOO_LARGE | 413 | File exceeds the 10MB size limit |
| UNSUPPORTED_MEDIA_TYPE | 415 | File type is not CSV, XLS, or XLSX |
Examples
- cURL
- JavaScript
- SDK
curl -X POST https://api.zenpayz.com/merchant/api/v1/chargebacks/bulk \
-H "Authorization: Bearer zp_test_xxxxx" \
-H "X-Timestamp: 2024-01-15T10:30:00.000Z" \
-H "X-Signature: a1b2c3d4e5f6..." \
-H "X-Secret-Salt: your_secret_salt" \
-H "X-Merchant-Id: merch_xxxxx" \
-H "X-Request-Id: req_xxxxx" \
-F "file=@chargebacks.csv" \
-F "webhookUrl=https://example.com/webhooks/bulk-status"
const formData = new FormData();
formData.append('file', fileInput.files[0]);
formData.append('webhookUrl', 'https://example.com/webhooks/bulk-status');
const response = await fetch('https://api.zenpayz.com/merchant/api/v1/chargebacks/bulk', {
method: 'POST',
headers: {
'Authorization': `Bearer ${apiKey}`,
'X-Timestamp': timestamp,
'X-Signature': signature,
'X-Secret-Salt': secretSalt,
'X-Merchant-Id': merchantId,
'X-Request-Id': requestId,
},
body: formData,
});
const result = await response.json();
console.log(result.data.batchId); // "batch_a1b2c3d4e5f6g7h8"
console.log(result.data.status); // "processing"
const result = await zenpays.chargebacks.bulkUpload({
file: fs.createReadStream('chargebacks.csv'),
webhookUrl: 'https://example.com/webhooks/bulk-status',
});
console.log(result.batchId); // "batch_a1b2c3d4e5f6g7h8"
console.log(result.status); // "processing"