braintree / braintree-web

A suite of tools for integrating Braintree in the browser
https://developer.paypal.com/braintree/docs/start/hello-client/javascript/v3
MIT License
442 stars 134 forks source link

ReferenceError: paypal is not defined #335

Closed brecons closed 6 years ago

brecons commented 6 years ago

The paypal reference is not defined even if the scripts are included like described in the documentation (https://developer.paypal.com/docs/accept-payments/express-checkout/ec-braintree-sdk/client-side/javascript/v3/):

<script src="https://js.braintreegateway.com/web/3.25.0/js/client.min.js"></script>
<script src="https://js.braintreegateway.com/web/3.25.0/js/paypal-checkout.min.js"></script>

<script>
    paypal.Button.render({
        braintree: braintree,
        // Other configuration
    }, '#btn-paypal');
</script>

The following error occurs: Uncaught ReferenceError: paypal is not defined

crookedneighbor commented 6 years ago

You have not included Checkout.js on your page.

<script src="https://www.paypalobjects.com/api/checkout.js" data-version-4></script>

I see that it is not 💯 clear on that page you linked. (it is shown later on, but not at the beginning) We'll get that updated.