The Paypal checkout on the secure website was experiencing technical difficulties

Having trouble with my PayPal button (which is actually express checkout) not working on HTTPS. I first noticed this issue when accessing my live app using HTTPS.

I'm unsure if it's my HTTPS setup that's causing the script to fail.

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

The button loads without any issues on localhost during development. However, in production with HTTPS, I encounter the following error:

ppxo_xc_ppbutton_error Object 

 Error: Document is ready and element #paypal-button does not exist

My implementation is within an Angular controller:

    paypal.Button.render({

      env: 'production', // Optional: specify 'sandbox' environment

      payment: function() {

          var env    = this.props.env;
          var client = this.props.client;

          return paypal.rest.payment.create(env, client, {
              transactions: [{
                  amount: { total: 5 , currency: 'USD' },
                  item_list: {
                  items: [{
                      "name": "profile",
                      "price": "5",
                      "currency": "USD"
                  }]
                }
              }],
              redirect_urls: {
                "return_url": $location.absUrl(),
                "cancel_url": $location.absUrl()
              }
          });
      },

      commit: true, // Optional: show a 'Pay Now' button in the checkout flow

      onAuthorize: function(data, actions) {

          return actions.payment.execute().then(function() {

              actions.payment.get().then(function(data){

                if(data.state === 'approved'){
                  $http.post('/paid',{qty:$scope.number_of_uses,user_email:user_email})
                  .then(function(response){

                      $scope.done = true;

                  });
                }

              });

          });
      }

  }, '#paypal-button');

To reiterate, everything works fine on localhost but encounters issues on HTTPS in production.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The validation of pre-filled input fields in Angular Material dialogs is not working as expected

I am encountering an issue with a mat-dialog that opens through an edit button within a (mat-)table. Upon opening the dialog, data is passed to populate certain input fields. One of these inputs has validation requiring that it cannot be left empty. The ...

Retrieve the content of a different page and store it as a variable using ajax

Is it possible to assign the content of another HTML page to a JavaScript variable? I attempted: var X = $(http://www.website.com/home).html() Unfortunately, this did not work, even though it seemed like a good idea. Can anyone provide guidance on how t ...

There is a JSON issue present, with half of the variables being undefined

Having an issue with my JSON as it throws me an undefined error. What's puzzling is that it recognizes my first variable without any problem. Below are the codes for better understanding: JSON {"Comics":[ {"comic" : { "src":"Pictures/Comic ...

Adjust the width of the iframe

I've been tasked with customizing a customer's website, and the admin has given me permission to use my own JavaScript file (myScript.js). How can I manipulate the iframe width from 160px to 200px using DOM Operations? <div id="iframeDiv& ...

React's componentWillMount() does not support the use of "if" statements

I've been working on a component called "App" that includes a function componentWillMount. The purpose of this function is to redirect React Router when a certain condition is false. componentWillMount() { const isLoggedIn = session.getLogin() ...

What is the correct way to send parameters in the action tag?

Can I set the res variable as the form action in HTML? <script> var name =$("#name").val(); var file =$("#file").val(); var res= localhost:8080 + "/test/reg?&name="+name+"&file=" +file ; </script> <form acti ...

View the picture in a web browser

Currently, I am faced with the challenge of displaying an image that is stored in an MSSQL database created by another person. The column was originally of type IMAGE, but I converted it to varbinary(MAX) using Sequelize. Although I lost some data during ...

Easily linking a React app to MongoDB

I recently developed a basic react app using 'create-react-app'. The app includes a form, validation, and Bootstrap components. It may not be extravagant, but it functions flawlessly. Furthermore, I registered with MongoDB to obtain a compliment ...

What is the best approach for retrieving Google API responses - accessing them directly from the frontend or routing through the backend first?

Currently, I am in search of the optimal location to make Google API requests. Given that Google Maps is utilized in the front end, we have the option to directly call the distance API service from there. However, we also have the choice to access these se ...

What is the best way to strip out a changing segment of text from a string?

let: string str = "a=<random text> a=pattern:<random text (may be fixed length)> a=<random text>"; In the given string above, let's assume that a= and pattern are constants. It is possible that there may or may not be a ...

`Using Rollup to combine local typescript files into a single main bundle`

I'm currently working on developing an npm module that is intended for use in web browsers. For this project, I have chosen to utilize TypeScript and Rollup as my tools of choice. Here is a snippet of my tsconfig.json: { "compilerOptions": { " ...

unable to clear form fields after ajax submission issue persisting

After submitting via ajax, I am having trouble clearing form fields. Any help in checking my code and providing suggestions would be greatly appreciated. Here is the code snippet: jQuery(document).on('click', '.um-message-send:not(.disabled ...

Install global npm modules in alternative directories for Node.js

Currently, I am encountering difficulties with installing global modules on my Ubuntu Unix OS. Upon investigating the location of the node_modules folder, I discovered that npm had installed some global modules in /usr/lib/node_modules while others were ...

Issue with Facebook like button not consistently loading on the website

Getting ready to release my new iOS app that creates customized mp3s and distributes them through a CDN-hosted webpage. Check it out at . I've integrated the XFBML code from http://developers.facebook.com/docs/reference/plugins/like/ because it' ...

ES6 Babel's grammar is set to be exported as the default

When using Babel, I am encountering an issue with importing the module shown below: // mongoose_helpers.js const r_string = { type: String, required: true } const r_number = { type: Number, required: true } export default { r_string, r_number } ...

Platform error: Responses not specified for DIALOGFLOW_CONSOLE

I've been struggling with this issue for almost a day now and I'm at a loss for what else to try. For some reason, Dialogflow Fulfillment in Dialogflow ES is refusing to make any HTTP calls. Every time I attempt, I receive the same error message ...

What are the steps to execute a file on localhost using an HTML page?

Currently, I have an HTML file that leverages the Google Calendar API javascript to read the next event on my calendar. The functionality works flawlessly when manually inserting a specific URL in a browser address window, which triggers a GET request in a ...

Eliminate items from the array if the property of an object includes any of the provided substrings

In an attempt to minimize the objects within arrays that have a property "Title" containing any substring listed in a separate JSON file, I have been struggling with filtering the arrays based on the object's property. However, I believe using the red ...

Encountered Axios GET error, [nodemon] server crashed - currently monitoring for any file modifications before relaunching (using express js, mysql, and react

Initially, my backend was running smoothly until I encountered an issue with axios not being able to retrieve GET data from the backend. In an attempt to resolve this, I changed the port to 8000 in the index.js file, but this caused the backend server to c ...

Creating custom CSS data-tooltip for image maps without the use of jquery

I stumbled upon the Pure CSS Tooltips (data-tooltip) feature showcased at http://www.frequency-decoder.com/demo/css-tooltips/, and I am eager to implement it on a specific area of an image map in a rectangular shape. However, despite finding a JavaScript c ...