Troubleshooting and Testing PayPal
Troubleshooting Common Issues
PayPal Buttons Not Appearing If the PayPal buttons are not rendering on your page, check the following:
- Ensure you have passed a valid selector ID for showPayPalButtons() to StaxJs for the PayPal buttons that correspond to an HTML ID for the DOM container.
- Confirm that the container component for the PayPal buttons also has the same ID value. Without matching IDs, the buttons will not load correctly.
- If the PayPal buttons are still not appearing and showPayPalButtons returns “form successfully loaded,” the PayPal gateway may not have been added. There is no HTML validation to confirm that the form was loaded correctly, so no error is thrown.
Backend Error: PayPal Gateway Not Enabled If you receive the error:
"The requested resource was not found"
and an API response
{"error": "Paypal gateway not found"}
This indicates that your PayPal gateway is either missing or incorrectly configured. This error is a validation error sent from the API. Confirm with the Integrations team that the PayPal gateway is present and properly configured.
Testing PayPal
Please refer to the codepen below for an example of a test configuration. Once your PayPal account has been set up by Stax, you can use the provided code as a base for your PayPal integration.
Testing Cards
Below is a list of test cards provided by PayPal.
Card Number | Card Brand |
---|---|
371449635398431 | American Express |
36259600000004 | Diner’s Club / Discover |
2223000048400011 | Mastercard |
4005519200000004 | Visa |
To thoroughly test your PayPal integration, you can simulate a range of transactions in the PayPal Sandbox. This includes successful payments, various failure scenarios, and refunds. For detailed information, you can refer to the PayPal Card Testing page.
Success Scenario Testing
- On PayPal’s developer documentation, navigate to the PayPal Card Testing page Simulate successful payments section or Test generated card numbers section to access test card numbers.
- Click the PayPal button and log in using your PayPal sandbox credentials. Open the PayPal modal and click Add Credit or Debit Card to add a test card to your account.
- Click Complete Purchase to see that your transaction has been successful.
Failure Scenario Testing
- On PayPal’s developer documentation, navigate to the PayPal Card Testing page to generate test cards for different rejection scenarios.
- Use the Test Credit Card Generator section to create test cards of different types.
- After generating your test card, view all trigger codes in the Rejection Triggers section. These triggers will simulate different types of failure responses.
- Click the PayPal button to open the PayPal sign-in modal to initiate the payment.
- Once logged in, select the Add Credit or Debit Card option.
- Enter your test-generated card number from the Card Testing page. For the first name, input the rejection trigger value you want to test and use another value for the last name. The last name should not be blank.
- Once the test card is saved, select it for use. Then, click the option to add a new address. Enter any address, but ensure the first name matches the rejection trigger value. The last name should be different from the rejection trigger value and not blank.
- Save the new address and ensure it is selected, along with the test card you created. Then, click Complete Purchase.
- You should see the error message and response corresponding to the specified rejection code.
Updated 1 day ago