Paypal Express Checkout error 400 - payment.Button javascript

103
April 26, 2018, at 5:27 PM

I'm trying to pay with paypal using Express checkout button, for a few days it worked just as expected but not until lately. It just keeps on returning error 400 (Bad Request) with this response:

{ "error": "invalid_client", "error_description": "Client credentials are missing" }

I'm pretty sure I provided the Client ID correctly. I've been cracking my head on how to fix this problem for 2 days now. Any help will be very much appreciated. Thanks!

paypal.Button.render({ 
    env: 'sandbox', 
 
    commit: true, // Show a 'Pay Now' button 
 
    style: { 
        label: 'pay', 
        color: 'gold', 
        size: 'large', 
        shape: 'pill' 
    }, 
 
    client: { 
        sandbox:    'Ad4DvCY2DkeVGuQIpQ2IeNVYbGPj9UYVkbxTyaWa3pDpMdM2g2ulWLIhOX3IL9toUDdZmKHQDf3Jq91O', 
        production: 'xxxxxxxxx' 
    }, 
 
    payment: function(data, actions) { 
        /*  
         * Set up the payment here  
         */ 
        return actions.payment.create({ 
            payment: { 
                transactions: [ 
                    { 
                        amount: { total: '20.00', currency: 'USD' } 
                    } 
                ] 
            } 
        }); 
    }, 
 
    onAuthorize: function(data, actions) { 
        /*  
         * Execute the payment here  
         */ 
        return actions.payment.execute().then(function(payment) { 
 
            // The payment is complete! 
            // You can now show a confirmation message to the customer 
            console.log(payment); 
            alert("Payment successful."); 
        }); 
    }, 
 
    onCancel: function(data, actions) { 
        /*  
         * Buyer cancelled the payment  
         */ 
        console.warn("Payment cancelled."); 
    }, 
 
    onError: function(err) { 
        /*  
         * An error occurred during the transaction  
         */ 
        // showErrorMsg("Something went wrong with Paypal integration."); 
        console.warn(err); 
    } 
}, '#paypal-button');
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
<script src="https://www.paypalobjects.com/api/checkout.js"></script> 
 
<div id="paypal-button"></div>

READ ALSO
Updating an array for jQuery fade in and fade out with setInterval

Updating an array for jQuery fade in and fade out with setInterval

I am trying to create a fade in/out effect with a array elements that change with timeThe array will be updated by a function that fetches the array items from a external source on an hourly basis

77
Randomize Hex Color Avoiding Light colors

Randomize Hex Color Avoiding Light colors

Is there a simple way to randomize hex color but avoiding very light colors? For example white, very light yellows,greens,blues,etc

73
JQuery Validate - Dynamic Form Field Messages

JQuery Validate - Dynamic Form Field Messages

I am using JQuery Validate to do validation on my forms

86
Open source funnel chart compatibility with licensed version fusion chart (FusionChartsXT 3.6 (Keycoded)) [on hold]

Open source funnel chart compatibility with licensed version fusion chart (FusionChartsXT 3.6 (Keycoded)) [on hold]

Can anyone help me to find out a open source/ free version of funnel chart in the market which is fully compatibility with FusionChartsXT 36 (Keycoded)(licenced version)

70