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 Codes
Validation Errors
INVALID_REQUEST Missing or invalid parameters Occurs when required fields are missing or contain invalid data types or formats.
Check Parameters
Verify all required parameters are present and correctly formatted
Validate Data Types
Ensure data types match the API specification
Retry with Corrected Data
Fix the request and retry
DUPLICATED_REQUEST Duplicated reference id Occurs when the same idempotency key is used for multiple requests.
Check Idempotency Key
Ensure the idempotency key is unique across all environments
Generate New Key
Create a new unique idempotency key
Retry Request
Retry with the new idempotency key
Authentication Errors
UNAUTHORIZED Unauthorized, invalid API Key Occurs when the API key is missing, invalid, or lacks necessary permissions.
Verify API Key
Check that the API key is correct and active
Check Encoding
Ensure the API key is properly base64 encoded with the colon
Contact Support
If the issue persists, contact Xendit support
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.
Verify Terminal ID
Double-check the terminal ID matches exactly
Check Registration Status
Contact support to verify registration is complete
Confirm Environment
Ensure using test API key with test terminal registration
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.
Check Terminal Capabilities
Verify the terminal supports the requested command
Use Alternative Terminal
Try a different terminal that supports the feature
Contact Support
Ask about terminal upgrade options if needed
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.
Check Supported Currencies
Verify which currencies are enabled for your account
Contact Support
Request currency activation from Xendit support
Use Supported Currency
Retry with a supported currency
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.
For testing purposes in test mode, the following special amounts and terminal IDs can be used to trigger specific situations or errors. Otherwise the API will always succeed.
These simulations only work in test mode. In production mode, all transactions will be processed normally.
Payment Session Simulations
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
API-only testing without hardware
✓ Immediate testing without hardware
✓ Comprehensive error scenario testing
✓ Webhook integration validation
✓ No registration required
✓ Faster development cycles
× No physical hardware validation
× Limited to API-level testing
Troubleshooting Real Terminal Testing
For runtime recovery scenarios such as timeouts, missing responses, and receipt-handling flows across H2H and C2C, see the SDK Troubleshooting Guide .
Symptoms : API calls succeed but terminal doesn’t show payment prompts
Check Terminal Status
Verify terminal shows “Connected” in Terminal Gateway
Verify Registration
Confirm terminal ID is registered for test mode
Test Network Connection
Ensure terminal has stable network connectivity
Restart Terminal Gateway
Restart the Terminal Gateway app/SDK connection
Symptoms : API returns error code TERMINAL_NOT_FOUND
Verify Terminal ID
Double-check the terminal ID matches exactly
Check Registration Status
Contact support to verify registration is complete
Confirm Environment
Ensure using test API key with test terminal registration
Transactions Fall Back to Simulation
Symptoms : API works but no physical terminal interaction
Confirm Registration
Verify terminal is registered (unregistered terminals auto-simulate)
Check Terminal Gateway Mode
Ensure Terminal Gateway is in test mode, not simulation mode
Validate Terminal Connection
Confirm terminal shows active connection status
Best Practice : Start with simulation testing for initial integration, then move to real terminal testing for final validation before production.
Testing
For comprehensive testing instructions, including both simulation and physical terminal testing, see our quickstart guide .