Errors & Simulations
Error handling is an essential part of integrating with the Xendit’s Payment Terminal API. This section covers error codes, error handling best practices, and testing simulations.Error Data Structure
An error occurs when the HTTP status is not 200.Error code
Error message
Error Codes
Validation Errors
INVALID_REQUEST
Missing or invalid parameters
Occurs when required fields are missing or contain invalid data types or formats.
Authentication Errors
UNAUTHORIZED
Unauthorized, invalid API Key
Occurs when the API key is missing, invalid, or lacks necessary permissions.
Terminal & Configuration Errors
TERMINAL_NOT_FOUND
The terminal id is not configured for your account
Occurs when the specified terminal ID is not registered or configured for your account.
COMMAND_NOT_SUPPORTED
The command currently not supported for this terminal
Occurs when attempting to use a feature or command not available on the specified terminal.
Business Logic Errors
CURRENCY_NOT_SUPPORTED
Currency is not supported for your account
Occurs when attempting to process a payment in a currency not enabled for your account.
Error Handling Best Practices
Parse Error Response
Always parse the error response and use the error code or message to determine the cause of the failure
Log Errors
Log error responses for debugging and monitoring purposes
Retry Logic
Implement appropriate retry logic for transient errors
User Feedback
Provide meaningful error messages to end users when appropriate
Example Error Response
Simulations
Perfect for merchants without physical terminals yet! You can start integrating immediately using our simulation capabilities. No need to wait for terminal delivery - test payment flows, error handling, and webhook integrations using special test amounts and terminal IDs.Getting Started Without Hardware: Use any
terminal_id value (like SIM001) and special test amounts to simulate different payment scenarios. This is ideal for merchants waiting on terminal delivery or those who want to build and test their integration before hardware arrives.Payment Session Simulations
| Case | Amount (6 digits) | Terminal ID | Description | Expected Behavior |
|---|---|---|---|---|
| Failed to Pay | 400508 | All | Emulates: Payment declined by terminal | Session created, transaction failed |
| Channel Unavailable | 400509 | All | Emulates: Channel is not available by any reason | Session failed to create |
| Canceled | 400711 | All | Emulates: User canceled on terminal | Session created, then canceled |
| Invalid TID | Any | 4040404 | Invalid terminal ID | Session creation fails |
Testing with Real Terminals in Test Mode
For detailed instructions on registering and testing with real terminals in test mode, see the Physical Terminal Testing section in our quickstart guide.Key Differences: Real Terminal Testing vs Simulation
- Real Terminal Testing
- Simulation Testing
Uses physical hardware with test transactions
- ✓ Real card reader interactions
- ✓ Real money movement
- ✓ Actual terminal display prompts
- ✓ Physical button presses and card taps
- ✓ Network connectivity testing
- ✓ Complete hardware validation
- ! Requires terminal registration
- ! Dependent on physical hardware
Troubleshooting Real Terminal Testing
Terminal Not Responding
Terminal Not Responding
Symptoms: API calls succeed but terminal doesn’t show payment prompts
TERMINAL_NOT_FOUND Error
TERMINAL_NOT_FOUND Error
Transactions Fall Back to Simulation
Transactions Fall Back to Simulation
Symptoms: API works but no physical terminal interaction
Best Practice: Start with simulation testing for initial integration, then move to real terminal testing for final validation before production.