Handle errors appropriately!

Error Codes

The following table lists client error codes that the vaultera switch SDK returns to your website for graceful handling.
Error TypeError Message
invalid_request_errorInvalid API key
invalid_request_errorInvalid value for <parameter_name>
invalid_request_errorMissing required parameter: <parameter_name>
invalid_request_errorInvalid client secret
invalid_request_errorInvalid promise
processing_errorPayment failed with the payment processor
internal_server_errorServer is unavailable
object_not_foundPayment does not exist
confirm_payment_failedAn unknown error occurred

Error Handling Best Practices

When implementing error handling in your application:
  1. Check for specific error types to provide appropriate user feedback
  2. Log errors appropriately for debugging and monitoring purposes
  3. Provide clear user messages that help users understand what went wrong
  4. Implement retry logic where appropriate for transient errors
  5. Have fallback mechanisms for critical payment flows

Common Error Scenarios

  • Invalid API Key: Ensure you’re using the correct publishable key for your environment
  • Missing Parameters: Verify all required parameters are included in your requests
  • Invalid Client Secret: Check that the client secret is valid and hasn’t expired
  • Payment Processor Errors: These may be temporary - consider implementing retry logic
  • Server Unavailable: Implement appropriate fallback messaging for users