Bootstrap FreeKB - PayPal - Resolve "Error: p is not a function"
PayPal - Resolve "Error: p is not a function"

Updated:   |  PayPal articles

Let's say you are using of the PayPal checkout APIs.

And something like this is being returned.

Error: p is not a function

 

I typically saw this when the systems at play were not using the same PayPal Client ID and Secret. For example, let's say you have an HTML page running on an HTTP web server which uses the PayPal Node.js client to present the PayPal checkout form. Upon entering data into the PayPal checkout form a request is made to a PayPal Flask server which returns a response to the PayPal Node.js client and the HTTP web server does something with the response, such as saying "order successfully placed.

 

In this scenario the HTML page running on the HTTP web server would have something like this. Notice the Client ID is abc123.

<script src="https://www.paypal.com/sdk/js?components=buttons,card-fields&client-id=abc123"></script>

 

Flask PayPal server would have something like this. Notice the Client ID is different, xyz123 in this example. This almost always caused "Error: p is not a function" to be returned by the Node.js PayPal client (checkout.js).

paypal_client: PaypalServersdkClient = PaypalServersdkClient(
    client_credentials_auth_credentials=ClientCredentialsAuthCredentials(
        o_auth_client_id='xyz987',
        o_auth_client_secret='123456'

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 1a7b3b in the box below so that we can be sure you are a human.