Handling Error Codes
Handling Error Codes in PayPal Integration
When integrating PayPal, 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.
The following table lists the possible error codes that can be returned by the component:
| Code | Message | Explanation |
|---|---|---|
| 1001 | PayPal terminal ID is missing | The terminalId parameter was not provided during initialization. |
| 1002 | Container element is missing | The containerElement parameter was not provided or the element does not exist in the DOM. |
| 1003 | Failed to fetch terminal configuration | The component failed to retrieve the configuration from the DNA Payments API for the given terminalId. |
| 1004 | PayPal configuration is missing in terminal configuration | The terminal configuration does not contain the necessary PayPal settings. |
| 1005 | PayPal is disabled in terminal configuration | PayPal payments are not enabled for the given terminalId. |
| 1006 | PayPal client ID is missing in terminal configuration | The PayPal client ID is missing from the terminal configuration. |
| 1007 | Failed to render PayPal button | The PayPal button could not be rendered in the container element. |
| 1008 | No result returned from onBeforeProcess | The onBeforeProcessPayment event handler did not return a promise that resolves with paymentData and token. |
| 1009 | Payment data is missing | The paymentData object is missing. It can be provided during initialization or returned by the onBeforeProcessPayment event handler. |
| 1010 | Token is missing | The token is missing. It can be provided during initialization or returned by the onBeforeProcessPayment event handler. |
| 1011 | Payment data field is missing in result from onBeforeProcess | The object returned by the onBeforeProcessPayment event handler is missing the paymentData field. |
| 1012 | Token field is missing in result from onBeforeProcess | The object returned by the onBeforeProcessPayment event handler is missing the token field. |
| 1013 | Failed to execute onBeforeProcess | The onBeforeProcessPayment event handler threw an error. |
| 1014 | Failed to create order | The component failed to create a PayPal order with the DNA Payments API. |
| 1015 | Failed to approve order | The component failed to approve the PayPal order with the DNA Payments API after the user authorized the payment. |
| 1000 | Something went wrong | An unexpected error occurred. |
| 400 | Bad request | The request to the DNA Payments API was malformed. |
| 401 | Unauthorized | The request to the DNA Payments API was not authorized. Check your token. |
| 403 | Forbidden | You do not have permission to perform the requested action. |
| 404 | Not found | The requested resource was not found on the DNA Payments API. |
| 500 | Internal server error | An error occurred on the DNA Payments API server. |