Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

299
Views
Failed to load resource: the server responded with a status of 406 ()

I am trying to integrate Stripe payment gateway in spring boot project. I am getting error from client side, I don't know why. I am using STS IDE.

Below is the checkout form:

             <div class="checkout">
                <form id="checkoutform" class="form" autocomplete="off">
                    <h4>Pay With Card</h4>
                    <!-- A Stripe Element will be inserted here. -->
                    <div id="payment-element"></div>
                    <button class="btn" id="submit" type="submit">
                        <i class="fa fa-lock"></i>Pay Now
                    </button>
                    <div id="error-message">
                        <!-- Display error message to your customers here -->
                    </div>
                </form>
                <div id="messages" role="alert" style="display: none;"></div>
               </div>
      <script src="https://js.stripe.com/v3/"></script>
      <script src="public/web/js/userpayment.js" defer></script> 

Below is the script for checkout page:

document.addEventListener('DOMContentLoaded', async () => {
debugger
    // Load the publishable key from the server. The publishable key is set in your .env file.
    const {publishableKey} = await fetch('api/config').then((r) => r.json());
    if (!publishableKey) {
        addMessage(
            'No publishable key returned from the server. Please check `.env` and try again'
        );
        alert('Please set your Stripe publishable API key in the .env file');
    }

    const stripe = Stripe(publishableKey, {
        apiVersion: '2020-08-27',
    });

});

Below is my payment controller:

@RequestMapping(value = {ApiUrl.apiConfig}, method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE})
    public ResponseEntity<?> config() {
        
        return new ResponseEntity<>(new ConfigResponse(stripePublishableKey), HttpStatus.OK);
    }

I don't know why I am getting this error.

Screenshot to show error

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!