Skip to main content

Testing PayPal Integration

Testing PayPal Integration

After completing the integration, it is crucial to thoroughly test the PayPal functionality in a sandbox environment to ensure everything works as expected before going live.

Testing in Sandbox

  • Use a PayPal Sandbox Account: To test transactions, you will need a PayPal sandbox account. You can create one for free on the PayPal Sandbox website. This allows you to simulate real-world transactions without using actual funds.

  • Simulate Various Scenarios: Test different payment scenarios to ensure your integration handles each case correctly. This should include:

    • Successful payments

    • Payment failures (e.g., insufficient funds)

    • User-cancelled payments

      Testing across different devices, browsers, and with various payment amounts will help cover all potential use cases.

Troubleshooting Payment Failures

  • Check Sandbox Configuration: If a payment fails, first ensure your integration is correctly configured for the sandbox environment. Verify you are using the correct terminalId and that PayPal is enabled for that terminal in your DNA Payments sandbox account.

  • Review Error Messages: Carefully check any error messages returned by the component or logged in the browser console. These messages provide valuable clues about the cause of the issue, whether it's a configuration problem, a network error, or an issue with the payment data.

Common Issues and Troubleshooting

  • PayPal Button Not Rendering:

    • Ensure the containerElement specified in the init() parameters exists in the DOM before the script runs.
    • Check for any errors in the browser console that might prevent the button from rendering.
    • Confirm that your terminalId is correct and has an active PayPal configuration in your DNA Payments account.
  • "Failed to fetch terminal configuration" Error:

    • This error means the component could not retrieve the settings for your terminalId.
    • Check your network connection and ensure the DNA Payments API is reachable.
    • Double-check that the terminalId is correct.
  • "PayPal client ID is missing in terminal configuration" Error:

    • This indicates that the PayPal client ID is missing from your terminal's configuration.
    • You will need to contact DNA Payments support to ensure your account is correctly set up for PayPal payments.

By following these steps and testing thoroughly in the sandbox, you can ensure a reliable and robust PayPal integration for your customers.