Add Response
Add a merchant response to a chargeback dispute.
POST
https://api.zenpayz.com/merchant/api/v1/chargebacks/:chargebackId/responseBearer · 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 | application/json |
X-Merchant-Id REQUIRED | Merchant identifier |
X-Request-Id REQUIRED | Unique request identifier |
Path Parameters
| Parameter | Type | Description |
|---|---|---|
chargebackId REQUIRED | string | Unique chargeback identifier |
Body Parameters
| Parameter | Type | Description |
|---|---|---|
response REQUIRED | string | Merchant response text (must be non-empty) |
Response
Success (200 OK)
{
"success": true,
"data": {
"chargebackId": "cb_a1b2c3d4e5f6g7h8",
"status": "pending_review",
"merchantResponse": "The customer received the product on January 12th. Delivery was confirmed with a signature. The tracking number is 1Z999AA10123456784. We have attached the signed delivery receipt and shipping confirmation as evidence.",
"updatedAt": "2024-01-19T09:15:00.000Z"
},
"message": "Response added successfully",
"error": null,
"meta": {
"request_id": "req_xxxxx",
"timestamp": "2024-01-19T09:15:00.000Z",
"processing_time_ms": 40,
"api_version": "v1",
"endpoint": "POST /chargebacks/:chargebackId/response",
"user_type": "merchant"
}
}
Error Responses
| Code | HTTP | Message |
|---|---|---|
| VALIDATION_ERROR | 400 | Invalid request parameters or empty response |
| UNAUTHORIZED | 401 | Invalid API key |
| CHARGEBACK_NOT_FOUND | 404 | Chargeback with the specified ID does not exist |
| INVALID_STATE | 409 | Chargeback is not in a state that accepts responses |
Examples
- cURL
- JavaScript
- SDK
curl -X POST https://api.zenpayz.com/merchant/api/v1/chargebacks/cb_a1b2c3d4e5f6g7h8/response \
-H "Authorization: Bearer zp_test_xxxxx" \
-H "X-Timestamp: 2024-01-19T09:15:00.000Z" \
-H "X-Signature: a1b2c3d4e5f6..." \
-H "X-Secret-Salt: your_secret_salt" \
-H "Content-Type: application/json" \
-H "X-Merchant-Id: merch_xxxxx" \
-H "X-Request-Id: req_xxxxx" \
-d '{
"response": "The customer received the product on January 12th. Delivery was confirmed with a signature. The tracking number is 1Z999AA10123456784."
}'
const response = await fetch('https://api.zenpayz.com/merchant/api/v1/chargebacks/cb_a1b2c3d4e5f6g7h8/response', {
method: 'POST',
headers: {
'Authorization': `Bearer ${apiKey}`,
'X-Timestamp': timestamp,
'X-Signature': signature,
'X-Secret-Salt': secretSalt,
'Content-Type': 'application/json',
'X-Merchant-Id': merchantId,
'X-Request-Id': requestId,
},
body: JSON.stringify({
response: 'The customer received the product on January 12th. Delivery was confirmed with a signature. The tracking number is 1Z999AA10123456784.',
}),
});
const result = await response.json();
console.log(result.data.chargebackId); // cb_a1b2c3d4e5f6g7h8
console.log(result.data.merchantResponse); // "The customer received the product..."
const result = await zenpays.chargebacks.addResponse('cb_a1b2c3d4e5f6g7h8', {
response: 'The customer received the product on January 12th. Delivery was confirmed with a signature. The tracking number is 1Z999AA10123456784.',
});
console.log(result.chargebackId); // cb_a1b2c3d4e5f6g7h8
console.log(result.merchantResponse); // "The customer received the product..."