Handling Error Codes
Handling Error Codes in Click to Pay Integration
When integrating Click to Pay, the component may return various error codes during different stages of the payment process. It is essential to handle these errors appropriately to ensure a smooth user experience and provide meaningful feedback to your customers.
Common Error Codes
1001: No Result Returned from onClick
- Description: This error occurs when no result is returned from the
onClick
event handler. It is specifically applicable if the merchant is passing payment data or a token during theonClick
event instead of during button initialization. To avoid this error, ensure that all necessary data is passed during button initialization.
- Description: This error occurs when no result is returned from the
1002: Payment Data Field Missing in Result from onClick
- Description: This error occurs when a required field in the payment data is missing in the result from the
onClick
event. This error is specifically applicable if the merchant is passing payment data during theonClick
event instead of during button initialization. To avoid this error, ensure that all necessary payment data is included during button initialization.
- Description: This error occurs when a required field in the payment data is missing in the result from the
1003: Token Field Missing in Result from onClick
- Description: This error occurs when the token field is missing in the result from the
onClick
event. This error is specifically applicable if the merchant is passing the token during theonClick
event instead of during button initialization. To avoid this error, ensure that the token is correctly generated and included during button initialization.
- Description: This error occurs when the token field is missing in the result from the
1004: Click to Pay Payment Declined
- Description: The payment was declined during the Click to Pay process. This could occur due to insufficient funds, incorrect payment details, or other issues with the card. Prompt the user to check their payment information and try again or use a different payment method.
Notes
User Experience: Provide clear instructions or next steps for the user when an error occurs, such as retrying the payment, using a different payment method, or contacting support.
By properly handling error codes, you can improve the reliability of your Click to Pay integration and ensure a better user experience.