Clien authentication failed

acuz
Contributor
Contributor

[PHP] I followed step by step the Smart Buttons Integration and installed the SDK. placed my client Id on the client side (SANDBOX)

 
and placed my clientid and secret in the sdk file 
     $clientId = getenv("CLIENT_ID"?: "<MY CLIENT ID>";
      $clientSecret = getenv("CLIENT_SECRET"?: "MY CLIENT SECRET";
 
but when i print the promise ;
 
  onApprovefunction(dataactions) {
                return actions.order.capture().then(function(details) {
                    alert('Transaction completed by ' + details.payer.name.given_name);
                    // Call your server to save the transaction
                    return fetch('paypal-transaction-complete.php', {
                        method: 'post',
                        headers: {
                            'content-type''application/json'
                        },
                        body: JSON.stringify({
                            orderID: data.orderID
                        })
                    }).then(function(res){
                        console.log(res.text());  //HERE I PRINT PROMISE IN CONSOLE
                    });
                });
            }
 
i get this error : Fatal error: Uncaught exception 'PayPalHttp\HttpException' with message '{"error":"invalid_client","error_description":"Client Authentication failed"}
 
Isnt the SDK supposed to deal with the authentication ? I'm stuck please help ! 
Login to Me Too
1 REPLY 1

MTS_Jennifer
Moderator
Moderator

Hello,

Thank you for posting to the PayPal Merchant Technical Support Community.

You may want to do a var dump to see if your correct credentials are being passed in. If the credentials are not being passed in correctly then you will receive the Client Authentication Failed message. Also verify that you are not storing your credentials with a space before or after. A space will be seen as a character and can cause Client Authentication Failed message.

 

Thank you,

Jennifer

PayPal

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.