API Error Codes Reference
Auto-generated. Do not edit manually.
Agent Object Error Codesβ
Location
Error Code Summary
| Error Title Reference | Error Title | HTTP Status | Detail Message | Scenario | Resolution |
|---|---|---|---|---|---|
| First Name Validation | INVALID_REQUEST | 400 BAD REQUEST | agent.firstName cannot be more than 50 characters | When first name exceeds 50 characters | Ensure the agent's first name is 50 characters or less |
| Last Name Validation | INVALID_REQUEST | 400 BAD REQUEST | agent.lastName cannot be more than 50 characters | When last name exceeds 50 characters | Ensure the agent's last name is 50 characters or less |
| User ID Validation | INVALID_REQUEST | 400 BAD REQUEST | agent.userId is required | When agent user ID is missing, null or empty | Include a valid agent.userId in the request |
Authorization Error Codesβ
Location
Error Code Summary
| Error Title Reference | Error Title | HTTP Status | Detail Message | Scenario | Resolution |
|---|---|---|---|---|---|
| Authorization Validation | |||||
| WITHOUT_TOKEN | UNAUTHORIZED | 401 UNAUTHORIZED | access_token is missing | When no access token is provided in the request | Include a valid access token in the Authorization header |
| EXPIRED_TOKEN | UNAUTHORIZED | 401 UNAUTHORIZED | jwt signature verification failed: 'exp' claim expired at | When the JWT token is expired | Generate a new JWT token using valid credentials |
| NULL_TOKEN | UNAUTHORIZED | 401 UNAUTHORIZED | invalid jwt: invalid jwt string | When the JWT token is null or malformed | Ensure a valid, properly formatted JWT token is provided |
| CROSS_MERCHANT_TOKEN | FORBIDDEN | 403 FORBIDDEN | 403 FORBIDDEN | When the token is for a different merchant | Use a token issued for the correct merchant ID |
| RESTRICTED_SCOPE_TOKEN | FORBIDDEN | 403 FORBIDDEN | insufficient_scope | When the token does not have sufficient scope | Request a token with the required scopes for the operation |
| INVALID_MERCHANTID | FORBIDDEN | 403 FORBIDDEN | 403 FORBIDDEN | When the merchant ID is invalid | Provide a valid merchant ID that you are authorized to access |
| MISSING_MERCHANT_HEADER | BAD_REQUEST | 400 BAD REQUEST | Missing request header 'X-Merchant-Id' for method parameter of type UUID | When X-Merchant-Id header is missing | Provide a valid merchant ID that you are authorized to access |
Consent Object Error Codesβ
Location
Error Code Summary
| Error Title Reference | Error Title | HTTP Status | Detail Message | Scenario | Resolution |
|---|---|---|---|---|---|
| Merchant Consent Text Validation | INVALID_REQUEST | 400 BAD REQUEST | Consent is Invalid! | Merchant consent text is invalid or contains unsupported characters | Remove special characters from consent text |
| Merchant Consent Id Validation | INVALID_REQUEST | 400 BAD REQUEST | merchantConsentId is required | Merchant consent id is missing or invalid | Provide a valid merchant consent ID in the request |
| Consent Collection Timestamp Validation | INVALID_REQUEST | 400 BAD REQUEST | collectionTimestamp is required | Consent collection timestamp is missing or invalid | Include a valid collection timestamp in ISO 8601 format |
| Consent Collection Details Validation | INVALID_REQUEST | 400 BAD REQUEST | collectionDetails are not valid | Consent collection details are missing or invalid | Provide complete and valid collection details |
| Agent Object Requirement with PPD Consent | INVALID_REQUEST | 400 BAD REQUEST | agent object is required with PPD consent | PPD consent requires agent object information | Include agent object with all required fields when using PPD consent |
Customer Object Error Codesβ
Location
Error Code Summary
| Error Title Reference | Error Title | HTTP Status | Detail Message | Scenario | Resolution |
|---|---|---|---|---|---|
| Identifier Validation | |||||
| Missing Required Identifiers | INVALID_REQUEST | 400 BAD REQUEST | customer should contain hsid, enterpriseId or metadata | Required customer identifiers are missing | Include at least one of hsid, enterpriseId, or metadata in the customer object |
| Invalid Enterprise ID | INVALID_REQUEST | 400 BAD REQUEST | invalid enterpriseId | Enterprise ID is not all digits | Ensure enterpriseId contains only numeric digits |
| Invalid HSID | INVALID_REQUEST | 400 BAD REQUEST | invalid hsid | HSID is not a valid UUID | Provide a valid UUID format for the hsid |
| Customer Not found for given Enterprise Id | NOT_FOUND | 404 NOT FOUND | Customer not found for given enterpriseId | No customer found for the provided enterpriseId | Verify the enterpriseId is correct and exists in the system |
| Metadata Validation | |||||
| Exceeded Metadata Entries | INVALID_REQUEST | 400 BAD REQUEST | Exceeded the max number of entries in metadata. Max 20 | Metadata has more than 20 entries | Reduce the number of metadata entries to 20 or fewer |
| Metadata Key Size Exceeded | INVALID_REQUEST | 400 BAD REQUEST | Metadata key size bigger than: 40 | Metadata key exceeds 40 characters | Ensure all metadata keys are 40 characters or less |
| Metadata Value Size Exceeded | INVALID_REQUEST | 400 BAD REQUEST | Metadata value size bigger than: 100 | Metadata value exceeds 100 characters | Ensure all metadata values are 100 characters or less |
| Demographics Validation | |||||
| Email Validation | INVALID_REQUEST | 400 BAD REQUEST | customer.email Email should be valid | Email is not in valid format | Provide a valid email address format (e.g., user@example.com) |
| First Name Length Exceeded | INVALID_REQUEST | 400 BAD REQUEST | First name max length is 100 | First name exceeds 100 characters | Ensure the first name is 100 characters or less |
| Last Name Length Exceeded | INVALID_REQUEST | 400 BAD REQUEST | Last name max length is 100 | Last name exceeds 100 characters | Ensure the last name is 100 characters or less |
| SSN Validation | INVALID_REQUEST | 400 BAD REQUEST | customer.ssnLastFour must match "^[0-9]4$" | SSN last four is not 4 digits | Provide exactly 4 digits for the SSN last four |
| ZIP Code Validation | INVALID_REQUEST | 400 BAD REQUEST | Zip 5 must be exactly 5 digits long. | ZIP code is not 5 digits | Provide exactly 5 digits for the ZIP code |
| Date of Birth Validation | INVALID_REQUEST | 400 BAD REQUEST | customer.dateOfBirth Invalid date of birth: <value> | Date of birth is not in ISO format | Use ISO 8601 format for date of birth (YYYY-MM-DD) |
| Country Code Validation | INVALID_REQUEST | 400 BAD REQUEST | customer.phoneNumber.countryCode invalid countryCode | Country code is not valid | Use a valid country code (e.g., 01, 91) |
| Phone Number Validation | INVALID_REQUEST | 400 BAD REQUEST | customer.phoneNumber.number invalid number | Phone number is not valid | Provide a valid phone number format |
Payment Details Object Error Codesβ
Location
Error Code Summary
| Error Title Reference | Error Title | HTTP Status | Detail Message | Scenario | Resolution |
|---|---|---|---|---|---|
| Payment Details Validation | |||||
| Payment Details Not Valid | INVALID_REQUEST | 400 BAD REQUEST | payment details are not valid | When Qualified Amount is either missing or null | Include a valid qualified amount in the payment details |
| Qualified + Vision Amount Exceeds Total Amount | INVALID_REQUEST | 400 BAD REQUEST | details qualified amount + vision amount cannot be greater than amount | When the sum of qualified amount and vision amount exceeds the total amount | Ensure the sum of qualified and vision amounts is less than or equal to the total amount |
| Prescription Amount Exceeds Qualified Amount | INVALID_REQUEST | 400 BAD REQUEST | details prescription amount cannot be greater than qualified amount | When prescription amount is greater than qualified amount | Ensure prescription amount is less than or equal to qualified amount |
Payment Method Details Error Codesβ
Location
Error Code Summary
| Error Title Reference | Error Title | HTTP Status | Detail Message | Scenario | Resolution |
|---|---|---|---|---|---|
| Nickname Format | PAYMENT_METHOD_ERROR | 400 | Nickname must be alphanumeric and up to 30 characters. | Nickname contains special characters or is too long | Use only letters and numbers for the nickname and keep it under 30 characters |
| Nickname Contains Account # | PAYMENT_METHOD_ERROR | 400 | nickname shouldn't contain account number | Nickname includes the bank account number | Remove any account numbers from the nickname field |
| Nickname Contains Card # | PAYMENT_METHOD_ERROR | 400 | Please make sure that the nickname field doesn't contain a card number. | Nickname includes a card number | Remove any card numbers from the nickname field |
| Error Title Reference | Error Title | HTTP Status | Detail Message | Scenario | Resolution |
|---|---|---|---|---|---|
| Name Contains Account # | PAYMENT_METHOD_ERROR | 400 | nameOnAccount shouldn't contain account number | Name on account includes the account number | Remove any account numbers from the name on account field |
| Account Number Format | PAYMENT_METHOD_ERROR | 400 | accountNumber is not valid | Account number contains non-digits | Ensure account number contains only numeric digits |
| Account Number Length | PAYMENT_METHOD_ERROR | 400 | accountNumber can be upto 17 digits | Account number is longer than 17 digits | Provide an account number that is 17 digits or less |
| Required Account Number | PAYMENT_METHOD_ERROR | 400 | accountNumber is required | Account number is missing | Include a valid account number in the request |
| Valid Account Type | PAYMENT_METHOD_ERROR | 400 | accountType is not valid | Account type is not checking or savings | Use only 'checking' or 'savings' for account type |
| Required Account Type | PAYMENT_METHOD_ERROR | 400 | accountType is required | Account type is missing | Include the account type (checking or savings) in the request |
| Bank Account Details Required | PAYMENT_METHOD_ERROR | 400 | Bank Account details are needed | Bank account details missing | Provide all required bank account details |
| Routing Number Required | PAYMENT_METHOD_ERROR | 400 | routingNumber is required | Routing number is missing | Include a valid routing number in the request |
| Routing Number Format | PAYMENT_METHOD_ERROR | 400 | routingNumber must be a 9 digit number | Routing number is not 9 digits | Ensure routing number is exactly 9 digits |
| Name on Account Required | PAYMENT_METHOD_ERROR | 400 | Name on account is required | Name on account is missing | Include the name on account in the request |
| Invalid Payment Method Type | PAYMENT_METHOD_ERROR | 400 | BANK_ACCOUNT type is not applicable for paymentMethod.type | Bank account type used with card | Use consistent payment method types (don't mix card and bank account details) |
| Error Title Reference | Error Title | HTTP Status | Detail Message | Scenario | Resolution |
|---|---|---|---|---|---|
| Medication Label Validation | PAYMENT_METHOD_ERROR | 400 | Medication label cannot be empty and maximum allowed length is 100 | Empty or too long medication label in cardCategories | Provide a non-empty medication label under 100 characters |
| Medication Value Validation | PAYMENT_METHOD_ERROR | 400 | Medication value cannot be empty and maximum allowed length is 100 | Empty or too long medication value in cardCategories | Provide a non-empty medication value under 100 characters |
| Invalid Card Category Type | PAYMENT_METHOD_ERROR | 400 | Invalid card category type | Unsupported card category type in cardCategories | Set Supported Card Category as per the merchant settings |
| Error Title Reference | Error Title | HTTP Status | Detail Message | Scenario | Resolution |
|---|---|---|---|---|---|
| Name on Card Required | PAYMENT_METHOD_ERROR | 400 | Name on card must not be blank. | Name on card is blank | Provide a non-empty name on the card field |
| Card Number in Name Field | PAYMENT_METHOD_ERROR | 400 | Please make sure that the name field doesn't contain a card number. | Name on card contains a card number | Remove any card numbers from the name on card field |
| Vendor Payment Method ID Required | PAYMENT_METHOD_ERROR | 400 | vendorPaymentMethodId is required | Vendor payment method ID missing | Include the vendor payment method ID in the request |
| Error Title Reference | Error Title | HTTP Status | Detail Message | Scenario | Resolution |
|---|---|---|---|---|---|
| Payment Method Required | PAYMENT_METHOD_ERROR | 400 | paymentMethod is required | Payment method is missing | Include the payment method object in the request |
| Payment Method Type Required | PAYMENT_METHOD_ERROR | 400 | paymentMethod type is required | Payment method type is missing | Specify a valid payment method type (e.g., "CARD" or "BANK_ACCOUNT") |
Payment Object Error Codesβ
Location
Error Code Summary
| Error Title Reference | Error Title | HTTP Status | Detail Message | Scenario | Resolution |
|---|---|---|---|---|---|
| Payment Object Validation | |||||
| Partial Authorization Not Allowed | INVALID_REQUEST | 400 BAD REQUEST | Partial authorization not allowed for authorizeCard = false | When sending a request with partialAuthorization=true, authorizeCard=false, and a card included in the request | Set authorizeCard=true when using partialAuthorization=true |
| Statement Descriptor Suffix Invalid | INVALID_REQUEST | 400 BAD REQUEST | payment.statementDescriptorSuffix only allows alphanumeric, space, hyphen and dot with at least one letter and allowed maximum length is 10 | When statement descriptor suffix is invalid | Use only alphanumeric characters, spaces, hyphens, and dots in the suffix; include at least one letter; and keep it under 10 characters |
| Invalid Amount | INVALID_REQUEST | 400 BAD REQUEST | Invalid amount ${validatedValue}, it must be between 1 and 99999999 and not contain decimals | When amount format is invalid | Ensure amount is a whole number between 1 and 99999999 and does not contain decimals |
| Exceeded Metadata Entries | INVALID_REQUEST | 400 BAD REQUEST | Exceeded the max number of entries in metadata. Max 20 | When exceeding the maximum number of metadata entries | Reduce the number of metadata entries to 20 or fewer |
| Metadata Key Size Exceeded | INVALID_REQUEST | 400 BAD REQUEST | Metadata key size bigger than: 40 | When a metadata key exceeds maximum allowed length | Ensure metadata keys are 40 characters or less |
| Metadata Value Size Exceeded | INVALID_REQUEST | 400 BAD REQUEST | Metadata value size bigger than: 100 | When a metadata value exceeds maximum allowed length | Ensure metadata values are 100 characters or less |
| Merchant Transaction ID Required | INVALID_REQUEST | 400 BAD REQUEST | merchantTransactionId is required | When merchant transaction ID is missing in the payment object | Include a unique merchantTransactionId in the payment request |
| Customer Required | INVALID_REQUEST | 400 BAD REQUEST | Customer is required | When customer object is missing | Include the customer object with appropriate identifiers in the request |
Cancel Payment Error Codesβ
Location
Error Code Summary
| 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 |
Capture Payment Error Codesβ
Location
Error Code Summary
| Error Title Reference | Error Title | HTTP Status | Detail Message | Scenario | Resolution |
|---|---|---|---|---|---|
| Invalid Amount | INVALID_REQUEST | 400 BAD REQUEST | amount Invalid amount ${amount}, it must be between 1 and 99999999 | Amount is zero, negative, or out of allowed range | Provide a positive integer amount between 1 and 99999999 |
| Invalid Decimal Amount | INVALID_REQUEST | 400 BAD REQUEST | amount Invalid amount ${amount}, it must be between 1 and 99999999 | Amount is not a valid integer (decimal provided) | Use whole number amounts without decimals or fractional values |
| Capture Exceeds Authorized | INVALID_REQUEST | 400 BAD REQUEST | Capture amount exceeds authorized amount or no amount authorized for capture | Capture amount is greater than pre-authorized amount or no pre-authorization exists | Ensure capture amount is less than or equal to the authorized amount |
| Metadata Key Size | INVALID_REQUEST | 400 BAD REQUEST | payment.metadata Metadata key size bigger than: 40 | Metadata key exceeds 40 characters | Keep metadata keys to 40 characters or less |
| Metadata Value Size | INVALID_REQUEST | 400 BAD REQUEST | payment.metadata Metadata value size bigger than: 100 | Metadata value exceeds 100 characters | Keep metadata values to 100 characters or less |
| Metadata Entry Limit | INVALID_REQUEST | 400 BAD REQUEST | payment.metadata Exceeded the max number of entries in metadata. Max 20 | More than 20 metadata entries provided | Limit metadata entries to a maximum of 20 key-value pairs |
| Invalid Payment Status | INVALID_REQUEST | 400 BAD REQUEST | Payment with ${paymentId} is in invalid status: COMPLETED | Attempt to capture a payment that is already completed | Only attempt to capture payments that are in AUTHORIZED status |
Payment Authorization Error Codesβ
Location
Error Code Summary
| Error Title Reference | Error Title | HTTP Status | Detail Message | Scenario | Resolution |
|---|---|---|---|---|---|
| Payment Authorization | |||||
| Cross-Merchant Payment Capture | FORBIDDEN | 403 FORBIDDEN | Not authorized to capture this payment | When merchant2 attempts to capture a payment initiated by merchant1 | Use the same merchant credentials that were used to create the payment |
| Cross-Merchant Payment Cancellation | FORBIDDEN | 403 FORBIDDEN | Not authorized to cancel this payment | When merchant2 attempts to cancel a payment initiated by merchant1 | Use the same merchant credentials that were used to create the payment |
Payment Error Codesβ
Location
Error Code Summary
| Error Title Reference | Error Title | HTTP Status | Detail Message | Scenario | Resolution |
|---|---|---|---|---|---|
| Consent Requirement | INVALID_REQUEST | 400 BAD REQUEST | Consent is required! | When a ACH payment is initiated without the required consent information | Include a valid consent object with all required fields for ACH Payments |
| VendorPaymentMethodId Reuse | INVALID_REQUEST | 400 BAD REQUEST | VendorPaymentMethodId cannot be reused. | When attempting to use a vendor payment method ID that has already been used | Use a unique vendor payment method ID that hasn't been used before |
| Payment Method Not Found | NOT_ACCEPTABLE | 406 NOT ACCEPTABLE | Payment Method not found | When the requested payment method cannot be found in the system | Verify the payment method ID is correct and exists for the customer |
| Payment Method Authorization Failed | NOT_ACCEPTABLE | 406 NOT ACCEPTABLE | Payment method could not be authorized. Please try a different payment method. | When the payment method cannot be authorized for the transaction | Try a different payment method or check with the customer about potential issues with their payment method |
| Payment Method Type Not Configured | NOT_ACCEPTABLE | 406 NOT ACCEPTABLE | Payment method type is not configured. | When the payment method type is not configured for the merchant | Contact support to ensure your merchant account is configured for the payment method type you're trying to use |
| Payment Already Processed | INVALID_REQUEST | 400 BAD REQUEST | Payment already processed or in process for given transactionId | When attempting to process a payment with merchant transaction id that is already processed or currently being processed | Use a unique merchant transaction ID for each payment request |
| Maximum Retries Reached | PAYMENT_ERROR | 403 FORBIDDEN | Payment failed after maximum retries | When the maximum number of payment retry attempts has been reached | Create a new payment transaction or contact support for assistance |
| Payment Information Not Found | NOT_FOUND | 404 NOT FOUND | Payment information not found. | When the requested payment information cannot be found in the system or when the payment is not associated to the merchant | Verify the payment ID is correct and belongs to your merchant account |
| Missing Merchant Transaction ID in GetPayment Call | INVALID_REQUEST | 400 BAD REQUEST | Required query parameter 'merchantTransactionId' is not present. Please review API specs https://docs.healthsafepay.com/api-reference/ | When the merchantTransactionId is missing from the request | Include the merchantTransactionId as a query parameter in your request |