paypal / paypal-js

Loading wrapper and TypeScript types for the PayPal JS SDK
Apache License 2.0
238 stars 83 forks source link

Cannot read properties of undefined (reading 'startsWith') #555

Open zy598586050 opened 3 months ago

zy598586050 commented 3 months ago

"@paypal/paypal-js": "^8.1.0"

BUG-DEMO: https://github.com/zy598586050/paypal-bug

gordonchanhk commented 2 months ago

Regarding the JS error that happen when you are trying to run loadscript: Screenshot 2024-08-21 at 18 05 35

As your dev lang is Vue, In your app.vue, div's id="paypal" will form a JS object instance, which conflict with the paypal JS SDK paypal object instance. image

Change id="paypal" to other id value, such as div id="paypal-container" and change corresponding reference can resolve the issue.