# Code and Formats source: https://developer.mastercard.com/ethoca-consumer-clarity-for-merchants/documentation/code-and-formats/index.md ## Response Status Codes {#response-status-codes} The client invoking an API expects response status codes consistent with the HTTP1.1 standard as described in RFC 7231 at . The following responses have particular relevance or common application to Ethoca's Merchant Transaction API: | HTTP Code | Description | Relevance | |-----------|---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 200 | Ok | Standard response for successful HTTP requests: Indicates that the merchant has successfully received the request. More information can be found in the [ResponseStatus object](https://developer.mastercard.com/ethoca-consumer-clarity-for-merchants/documentation/code-and-formats/index.md#response-result-status-object). | | 400 | Bad Request | Returned for any case where the request cannot be understood by the merchant system due to a malformed URL syntax or URL parameters. | | 401 | Unauthorized | The server understood the request but is refusing to fulfill it. Return this code if the HMAC signature does not match. | | 403 | Forbidden | The request is valid, but the caller does not have the necessary permissions, typically because the Authorization header is invalid. | | 405 | Method Not Allowed | The server does not implement the request's specified HTTP method, in this case, anything other than POST. | | 500 | Internal Error | Unexpected error. | | 503 | Service Unavailable | The server received the request but is not able to fulfill it. | ## Response Result Status Object {#response-result-status-object} For 200 responses, use the `ResponseStatus` object to provide additional response information as described in this table: | Scenario | Accepted ResponseStatus Values | Sample ResponseStatus Message | |--------------------------------------------------------------|--------------------------------|----------------------------------------------------| | Transaction was identified and some response data provided. | TRANSACTION_FOUND | OK. | | Transaction was not identified so no response data provided. | TRANSACTION_NOT_FOUND | The transaction could not be found. | | Multiple transactions were identified from the request data. | MULTIPLE_TRANSACTIONS_FOUND | Multiple transactions were found for this request. | ## Smart Subscriptions Specific Error Codes {#smart-subscriptions-specific-error-codes} ### 400 Bad Request {#400-bad-request} This table shows the code and message you might receive for the Smart Subscriptions API and the steps you can take to resolve the error. | Reason Code | Description | How to resolve | |-------------------------|------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `RESPONSE_CODE_MISSING` | A response code is required on all responses. | Provide a valid response code. | | `VALIDATION_FAILED` | One or more required fields are missing. | Provide all required fields. | | `VALIDATION_FAILED` | One or more conditional requirements are not met. | Make sure all conditional requirements are met. See [Conditional Fields](https://developer.mastercard.com/ethoca-consumer-clarity-for-merchants/documentation/tutorials-and-guides/subscription-control-guide/index.md#conditional-fields) for details about the fields that are required based on certain conditions. | | `MALFORMATED_FIELD` | The field was improperly formatted. | Provide a properly formatted field. | | `OFFER_NOT_ALLOWED` | In order to send a retention offer, the `offerAllowed` field must be `TRUE`. | Make sure the `offerAllowed` field is set to `TRUE`. | ## Common Integration Issues {#common-integration-issues} Here are some common issues you might encounter when integrating and suggestions for how to resolve them. ### Invalid or Missing Authorization Header {#invalid-or-missing-authorization-header} **Symptom:** The merchant endpoint rejects the request with an authentication-related HTTP response. **Possible cause:** The `Authorization` header is missing, malformed, uses an unsupported authentication method, or contains credentials that cannot be validated. **Resolution:** Confirm the authentication method selected during onboarding and validate the incoming header according to [Authentication and Encryption](https://developer.mastercard.com/ethoca-consumer-clarity-for-merchants/documentation/api-basics/authentication-and-encryption/index.md). ### HMAC Signature Mismatch {#hmac-signature-mismatch} **Symptom:** The merchant cannot validate an `ETHOCA-SHA1` or `ETHOCA-SHA512` signature. **Possible cause:** The merchant used the wrong key, request values, or signature construction when validating the incoming request. **Resolution:** Confirm the key ID, corresponding secret, request timestamp, and signature inputs. See [How to Create an HMAC Signature](https://developer.mastercard.com/ethoca-consumer-clarity-for-merchants/documentation/tutorials-and-guides/how-to-create-hmac-signature/index.md). ### Unsupported HTTP Method {#unsupported-http-method} **Symptom:** The merchant returns HTTP `405 Method Not Allowed`. **Possible cause:** The caller used a method that the endpoint does not support. **Resolution:** Confirm the required method and path in [API Reference](https://developer.mastercard.com/ethoca-consumer-clarity-for-merchants/documentation/api-reference/index.md). ### Malformed Request {#malformed-request} **Symptom:** The merchant returns HTTP `400 Bad Request`. **Possible cause:** The URL, parameters, headers, or JSON payload cannot be processed. **Resolution:** Validate the request against the applicable operation in [API Reference](https://developer.mastercard.com/ethoca-consumer-clarity-for-merchants/documentation/api-reference/index.md) and the common requirements in [API Request/Response Common Elements and Headers](https://developer.mastercard.com/ethoca-consumer-clarity-for-merchants/documentation/api-basics/common-elements-headers/index.md). ### Transaction Not Found {#transaction-not-found} **Symptom:** The request is valid, but no unique transaction matches the supplied criteria. **Resolution:** Return HTTP `200` with `responseStatus.code` set to `TRANSACTION_NOT_FOUND`. Review [Transaction Matching Guidance](https://developer.mastercard.com/ethoca-consumer-clarity-for-merchants/documentation/tutorials-and-guides/transaction-matching-guidance/index.md) to improve matching logic. ### Multiple Transactions Found {#multiple-transactions-found} **Symptom:** More than one transaction matches the request. **Resolution:** Return HTTP `200` with `responseStatus.code` set to `MULTIPLE_TRANSACTIONS_FOUND`. Review the matching fields and fuzzy-matching recommendations in [Transaction Matching Guidance](https://developer.mastercard.com/ethoca-consumer-clarity-for-merchants/documentation/tutorials-and-guides/transaction-matching-guidance/index.md). ### Missing or Invalid Response Fields {#missing-or-invalid-response-fields} **Symptom:** Ethoca rejects or cannot use the response payload. **Possible cause:** A required field is missing, a value uses the wrong data type or format, a length limit is exceeded, or an unsupported enumerated value is returned. **Resolution:** Validate the response against [API Reference](https://developer.mastercard.com/ethoca-consumer-clarity-for-merchants/documentation/api-reference/index.md) and [Merchant Order Inquiry API Field Recommendations](https://developer.mastercard.com/ethoca-consumer-clarity-for-merchants/documentation/api-basics/merchant-order-inquiry-field-recommendations/index.md). ### Response Timeout or Service Unavailable {#response-timeout-or-service-unavailable} **Symptom:** A request exceeds the supported response time or the endpoint returns HTTP `503 Service Unavailable`. **Resolution:** Confirm endpoint availability, review application logs, and verify that the integration meets the performance requirements in [Integration and Testing](https://developer.mastercard.com/ethoca-consumer-clarity-for-merchants/documentation/testing/index.md). ## Gateway Errors {#gateway-errors} For more information about 4xx/5xx response codes and possible resolutions, see [Gateway Error Codes](https://developer.mastercard.com/platform/documentation/security-and-authentication/gateway-error-codes/).