Cancel Invoice
Cancel an invoice. The invoice status will be updated to CANCELLED.
POST
https://api.zenpayz.com/merchant/api/v1/invoices/:invoiceId/cancelBearer · 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 |
Path Parameters
| Parameter | Type | Description |
|---|---|---|
invoiceId REQUIRED | string | The invoice ID (e.g. inv_a1b2c3d4e5f6g7h8) |
Response
Success (200 OK)
{
"success": true,
"data": {
"invoiceId": "inv_a1b2c3d4e5f6g7h8",
"status": "CANCELLED",
"cancelledAt": "2024-01-16T14:20:00.000Z"
},
"message": "Invoice cancelled successfully",
"error": null,
"meta": {
"request_id": "req_xxxxx",
"timestamp": "2024-01-16T14:20:00.000Z",
"processing_time_ms": 35,
"api_version": "v1",
"endpoint": "POST /invoices/:invoiceId/cancel",
"user_type": "merchant"
}
}
Error Responses
| Code | HTTP | Message |
|---|---|---|
| UNAUTHORIZED | 401 | Invalid API key |
| INVOICE_NOT_FOUND | 404 | Invoice does not exist |
| INVOICE_ALREADY_CANCELLED | 409 | Invoice has already been cancelled |
| INVOICE_PAID | 409 | Cannot cancel a fully paid invoice |