Skip to main content

Error Format

Handle errors gracefully to provide the best customer experience. All errors include clear codes and messages. Errors follow a consistent structure:

HTTP Status Codes

Error Codes

Client Errors (400-499)

Server Errors (500-599)

Handle Declined Payments

Show customer-friendly messages when payments are declined:

Declined Payment Response

Decline Reasons

Best Practices

Don’t expose specific decline reasons to customers. Use friendly, generic messages that don’t embarrass them.✅ Good: “Payment couldn’t be processed. Please try a different card.” ❌ Bad: “Insufficient funds in your account.”
When a payment is declined, suggest trying:
  • Another payment method
  • A different card
  • SPEI bank transfer (for large amounts)
  • PAYCASH cash payment (for unbanked customers)
  • CIE Cash Net deposit (for BBVA cash or bank payments)
Log the complete error response for your records, but show simplified messages to customers.
Let customers retry payments. Some declines are temporary (network issues, temporary holds).

Example: Handle Declined Payment

Retry Failed Requests

For temporary errors, implement retry logic with exponential backoff:

Safe Retries with Idempotency

Thanks to idempotency, you can safely retry requests without creating duplicate charges:
Always include an externalId to prevent duplicate charges when retrying failed requests.

Validation Errors

Handle validation errors before submitting:

Client-Side Validation

Validate data before sending to API:

Handle Authentication Errors

Invalid API Key

What to check:
  • API key is correct
  • Using the right environment (sandbox vs production)
  • The x-api-key header is present and correctly formatted

Example

Handle 3DS Errors

Authentication Required

This isn’t an error - it means 3DS is required. Display the authentication challenge.

Authentication Failed

What to do:
  • Show friendly message: “We couldn’t verify your identity. Please try again.”
  • Allow customer to retry
  • Offer alternative payment method

3D Secure Guide

Learn how to implement 3DS authentication

Rate Limiting

If you exceed rate limits:

Handle Rate Limits

Contact support@cheqpay.mx if you consistently hit rate limits. We can increase your limits.

Network Errors

Handle network connectivity issues:

Error Logging

Log errors for debugging and monitoring:
Never log sensitive data like full card numbers, CVCs, or API keys.

Error Monitoring

Set up alerts for critical errors:

Best Practices Summary

Show simple, non-technical error messages to customers. Log detailed errors for debugging.
Retry temporary failures with exponential backoff. Use idempotency to prevent duplicates.
Validate data before sending to API to provide instant feedback and reduce errors.
Log all errors with context for debugging. Never log sensitive data like card numbers.
Track error rates and set up alerts for unusual patterns or critical errors.
Offer alternative payment methods when primary method fails.

Next Steps

Testing Guide

Test error scenarios in sandbox

Best Practices

Follow recommended patterns

API Reference

View complete error reference

Contact Support

Get help with errors