cancel
Showing results for 
Search instead for 
Did you mean: 

Who Me Too'd this topic

HttpException: {"error":"invalid_client","error_description":"Client Authentication failed"}

mkgeneralaid
New Community Member

this posted and here

<Removed>

 

using Javascript SDK created sample live 0.01 sales SUCCESS

following the 

ID/secret here live

<Removed>

<Removed>

PHP SDK

https://developer.paypal.com/docs/checkout/reference/server-integration/setup-sdk/

Where put this:

$request = new OrdersCreateRequest();
$request->headers["prefer"] = "return=representation";

???

BUT here >>>

<Removed>

GETTING:  // WHERE is the error??? I used Live --- are headers the problem or is auth ???


Fatal error: Uncaught PayPalHttp\HttpException: {"error":"invalid_client","error_description":"Client Authentication failed"} in /home/polislatchiaptsv/public_html/main/vendor/paypal/paypalhttp/lib/PayPalHttp/HttpClient.php:215 Stack trace: #0 /home/polislatchiaptsv/public_html/main/vendor/paypal/paypalhttp/lib/PayPalHttp/HttpClient.php(100): PayPalHttp\HttpClient->parseResponse(Object(PayPalHttp\Curl)) #1 /home/polislatchiaptsv/public_html/main/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/AuthorizationInjector.php(37): PayPalHttp\HttpClient->execute(Object(PayPalCheckoutSdk\Core\AccessTokenRequest)) #2 /home/polislatchiaptsv/public_html/main/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/AuthorizationInjector.php(29): PayPalCheckoutSdk\Core\AuthorizationInjector->fetchAccessToken() #3 /home/polislatchiaptsv/public_html/main/vendor/paypal/paypalhttp/lib/PayPalHttp/HttpClient.php(64): PayPalCheckoutSdk\Core\AuthorizationInjector->inject(Object(PayPalCheckoutSdk\Orders\OrdersGetRequest)) #4 /ho in /home/polislatchiaptsv/public_html/main/vendor/paypal/paypalhttp/lib/PayPalHttp/HttpClient.php on line 215

 

<?php

namespace Sample;

require __DIR__ . '/vendor/autoload.php';
//1. Import the PayPal SDK client that was created in `Set up Server-Side SDK`.
use Sample\PayPalClient;
use PayPalCheckoutSdk\Orders\OrdersGetRequest;
use Sample\CaptureIntentExamples\CreateOrder;

class GetOrder
{

  // 2. Set up your server to receive a call from the client
  /**
   *You can use this function to retrieve an order by passing order ID as an argument.
   */
  public static function getOrder($orderId)
  {

    // 3. Call PayPal to get the transaction details
    $client = PayPalClient::client();
    $response = $client->execute(new OrdersGetRequest($orderId));
    /**
     *Enable the following line to print complete response as JSON.
     */
    //print json_encode($response->result);
    print "Status Code: {$response->statusCode}\n";
    print "Status: {$response->result->status}\n";
    print "Order ID: {$response->result->id}\n";
    print "Intent: {$response->result->intent}\n";
    print "Links:\n";
    foreach($response->result->links as $link)
    {
      print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n";
    }
    // 4. Save the transaction in your database. Implement logic to save transaction to your database for future reference.
    print "Gross Amount: {$response->result->purchase_units[0]->amount->currency_code} {$response->result->purchase_units[0]->amount->value}\n";

    // To print the whole response body, uncomment the following line
    // echo json_encode($response->result, JSON_PRETTY_PRINT);
  }
}

/**
 *This driver function invokes the getOrder function to retrieve
 *sample order details.
 *
 *To get the correct order ID, this sample uses createOrder to create a new order
 *and then uses the newly-created order ID with GetOrder.
 */
if (!count(debug_backtrace()))
{
  GetOrder::getOrder('9EC1989552495262M'true);  // SAMPLE SUCCESS 0.01 ID
}
?>

 

Login to Me Too
Who Me Too'd this topic