Error Handling
Learn how to handle errors gracefully in Bloque Payments.
Error Types
Bloque Payments can return different types of errors:
- Validation errors: Invalid input data
- Authentication errors: Invalid or missing API key
- Payment errors: Payment processing failures
- Network errors: Connection issues
Frontend Error Handling
Use the onError callback to handle errors in React:
Backend Error Handling
Handle errors in your payment endpoint:
Common Error Codes
Card Errors
card_declined: Card was declinedinsufficient_funds: Not enough fundsinvalid_card_number: Invalid card numberinvalid_expiry: Invalid expiration dateinvalid_cvv: Invalid security code
PSE Errors
bank_unavailable: Bank system unavailabletransaction_cancelled: User cancelled transactionauthentication_failed: Authentication failed
General Errors
invalid_amount: Invalid payment amountinvalid_currency: Unsupported currencyexpired_checkout: Checkout session expired
Retry Logic
Implement retry logic for transient errors:
User-Friendly Messages
Provide clear, actionable error messages:
Complete Error Handling Example
Next Steps
- Webhooks - Handle payment events
- Payment Methods - Learn about payment methods