Cancel Payment Error Codes
When to use this page
If you need to look up Cancel Payment Error Codes while resolving an API error, use this page.
This section documents validation and business rule errors for the Cancel Payment (/payments/{paymentId}/cancel) endpoint.
Error Code Summary β Cancel Payment
| Error Title Reference | Error Title | HTTP Status | Detail Message | Scenario | Resolution |
|---|---|---|---|---|---|
| Missing Cancellation Reason | INVALID_REQUEST | 400 BAD REQUEST | paymentCancellationReason must not be null | Reason not provided | Include a valid cancellation reason in the request |
| Invalid Cancellation Reason Enum | INVALID_REQUEST | 400 BAD REQUEST | Failed to read HTTP message Please review API specs https://docs.healthsafepay.com/api-reference/ | Reason is not one of: DUPLICATE, FRAUDULENT, REQUESTED_BY_CUSTOMER, ABANDONED | Use only allowed values: DUPLICATE, FRAUDULENT, REQUESTED_BY_CUSTOMER, or ABANDONED |
| Invalid Payment Id | INVALID_REQUEST | 400 BAD REQUEST | Invalid Payment, Payment Id: [${paymentId}], Payment Status: [COMPLETED] | Payment is already completed or invalid | Ensure payment is in a cancellable state (Only AUTHORIZED and ACCEPTED payments can be cancelled) |
| Invalid Payment Id Format | INVALID_REQUEST | 400 BAD REQUEST | Invalid payment id | Payment id is not found or is malformed | Provide a valid payment ID in the correct UUID format |
Error Codes Detailsβ
Cancel Payment Errorsβ
Missing cancellation Reasonβ
Missing Cancellation Reason
Occurs when the cancellation reason is not provided.
Sample Error Response:
{
"title": "INVALID_REQUEST",
"status": 400,
"detail": "paymentCancellationReason must not be null"
}
Invalid cancellation Reasonβ
Invalid Cancellation Reason Enum
Occurs when the cancellation reason is not one of the allowed enum values: DUPLICATE, FRAUDULENT, REQUESTED_BY_CUSTOMER, ABANDONED.
Sample Error Response:
{
"title": "INVALID_REQUEST",
"status": 400,
"detail": "Failed to read HTTP message Please review API specs https://docs.healthsafepay.com/api-reference/"
}
Invalid Payment Idβ
Invalid Payment Id
Occurs when the payment is already completed or invalid.
Sample Error Response:
{
"title": "INVALID_REQUEST",
"status": 400,
"detail": "Invalid Payment, Payment Id: [12345], Payment Status: [COMPLETED]"
}
Invalid Payment Id Formatβ
Invalid Payment Id Format
Occurs when the payment id is not found or is malformed.
Sample Error Response:
{
"title": "INVALID_REQUEST",
"status": 400,
"detail": "Invalid payment id"
}