PayPal PHP SDK: Authentication failed due to invalid authentication credentials or a missing Authorization...












0















I am new to PayPal SDK and trying to use the PayPal Checkout SDK in a Laravel application.



I have followed most of the instruction from the following github page, the first call to the function create-payment seems to work; however when I press continue on the PayPal pop-up window to execute the transaction it fails and produces the following error:



Error: Request to post /api/execute-payment failed with 500 error. Correlation id: unknown
{
"message": "Got Http response code 400 when accessing https://api.sandbox.paypal.com/v1/payments/payment/PAY-3RB62059V6076291ALRCHT6Y/execute.",
"exception": "PayPal\Exception\PayPalConnectionException",
"file": "C:\websites\online-webstore\vendor\paypal\rest-api-sdk-php\lib\PayPal\Core\PayPalHttpConnection.php",
"line": 207, {...}


Checking the link: https://api.sandbox.paypal.com/v1/payments/payment/PAY-3RB62059V6076291ALRCHT6Y/execute, I get the error:



{"name":"AUTHENTICATION_FAILURE","message":"Authentication failed due to invalid authentication credentials or a missing Authorization header.","links":[{"href":"https://developer.paypal.com/docs/api/overview/#error","rel":"information_link"}]}


This is my setup so for the client side:



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

<div id="paypal-button"></div>

<script>
paypal.Button.render({
env: 'sandbox', // Or 'production'
// Set up the payment:
// 1. Add a payment callback
payment: function(data, actions) {
// 2. Make a request to your server
return actions.request.post('/api/create-payment')
.then(function(res) {
// 3. Return res.id from the response
return res.id;
});
},
// Execute the payment:
// 1. Add an onAuthorize callback
onAuthorize: function(data, actions) {
// 2. Make a request to your server
return actions.request.post('/api/execute-payment', {
paymentID: data.paymentID,
payerID: data.payerID
})
.then(function(res) {
console.log(res);
alert('PAYMENT WENT THROUGH!!');
}).catch(function(err){
console.log("Error "+err);
});
}
}, '#paypal-button');
</script>


In my controller is set up like so:



class CheckoutController extends Controller
{

private $apiContext;
private $client_id;
private $secret;

public function __construct()
{
$this->middleware('auth', ['except'=>['createPayment', 'executePayment']]);

// Detect if we are running in live mode or sandbox
if(config('paypal.settings.mode') == 'live'){
$this->client_id = config('paypal.live_client_id');
$this->secret = config('paypal.live_secret');
} else {
$this->client_id = config('paypal.sandbox_client_id');
$this->secret = config('paypal.sandbox_secret');
}

// Set the Paypal API Context/Credentials
$this->apiContext = new ApiContext(new OAuthTokenCredential($this->client_id, $this->secret));
$this->apiContext->setConfig(config('paypal.settings'));
}

public function createPayment () {
$payer = new Payer();
$payer->setPaymentMethod("paypal");

$item1 = new Item();
$item1->setName('Ground Coffee 40 oz')
->setCurrency('USD')
->setQuantity(1)
->setSku("123123") // Similar to `item_number` in Classic API
->setPrice(7.5);
$item2 = new Item();
$item2->setName('Granola bars')
->setCurrency('USD')
->setQuantity(5)
->setSku("321321") // Similar to `item_number` in Classic API
->setPrice(2);

$itemList = new ItemList();
$itemList->setItems(array($item1, $item2));

$details = new Details();
$details->setShipping(1.2)
->setTax(1.3)
->setSubtotal(17.50);

$amount = new Amount();
$amount->setCurrency("USD")
->setTotal(20)
->setDetails($details);

$transaction = new Transaction();
$transaction->setAmount($amount)
->setItemList($itemList)
->setDescription("Payment description")
->setInvoiceNumber(uniqid());

$baseUrl = URL::to('/');
$redirectUrls = new RedirectUrls();
$redirectUrls->setReturnUrl("http://online-webstore/paypalRedirect/true")
->setCancelUrl("http://online-webstore/paypalRedirect/false");

$payment = new Payment();
$payment->setIntent("sale")
->setPayer($payer)
->setRedirectUrls($redirectUrls)
->setTransactions(array($transaction));

$request = clone $payment;

try {
$payment->create($this->apiContext);
} catch (Exception $ex) {
exit(1);
}

$approvalUrl = $payment->getApprovalLink();

return $payment;
}

public function executePayment (Request $request) {

$paymentId = $request->paymentID;
$payment = Payment::get($paymentId, $this->apiContext);

$execution = new PaymentExecution();
$execution->setPayerId($request->PayerID);

try {
$result = $payment->execute($execution, $this->apiContext);
} catch (PayPalExceptionPayPalConnectionException $ex) {
echo $ex->getData(); // Prints the detailed error message
die($ex);
}

return $result;
}

}


I have also correctly included my credential in my .env file and running it in sandbox mode.



Can someone direct me where I maybe going wrong also I am happy to provided any more information if required.










share|improve this question























  • Have you echoed config('paypal.settings.mode'), config('paypal.sandbox_client_id'); and config('paypal.sandbox_secret'); to double check that they are correct?

    – Magnus Eriksson
    Jan 20 at 14:37
















0















I am new to PayPal SDK and trying to use the PayPal Checkout SDK in a Laravel application.



I have followed most of the instruction from the following github page, the first call to the function create-payment seems to work; however when I press continue on the PayPal pop-up window to execute the transaction it fails and produces the following error:



Error: Request to post /api/execute-payment failed with 500 error. Correlation id: unknown
{
"message": "Got Http response code 400 when accessing https://api.sandbox.paypal.com/v1/payments/payment/PAY-3RB62059V6076291ALRCHT6Y/execute.",
"exception": "PayPal\Exception\PayPalConnectionException",
"file": "C:\websites\online-webstore\vendor\paypal\rest-api-sdk-php\lib\PayPal\Core\PayPalHttpConnection.php",
"line": 207, {...}


Checking the link: https://api.sandbox.paypal.com/v1/payments/payment/PAY-3RB62059V6076291ALRCHT6Y/execute, I get the error:



{"name":"AUTHENTICATION_FAILURE","message":"Authentication failed due to invalid authentication credentials or a missing Authorization header.","links":[{"href":"https://developer.paypal.com/docs/api/overview/#error","rel":"information_link"}]}


This is my setup so for the client side:



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

<div id="paypal-button"></div>

<script>
paypal.Button.render({
env: 'sandbox', // Or 'production'
// Set up the payment:
// 1. Add a payment callback
payment: function(data, actions) {
// 2. Make a request to your server
return actions.request.post('/api/create-payment')
.then(function(res) {
// 3. Return res.id from the response
return res.id;
});
},
// Execute the payment:
// 1. Add an onAuthorize callback
onAuthorize: function(data, actions) {
// 2. Make a request to your server
return actions.request.post('/api/execute-payment', {
paymentID: data.paymentID,
payerID: data.payerID
})
.then(function(res) {
console.log(res);
alert('PAYMENT WENT THROUGH!!');
}).catch(function(err){
console.log("Error "+err);
});
}
}, '#paypal-button');
</script>


In my controller is set up like so:



class CheckoutController extends Controller
{

private $apiContext;
private $client_id;
private $secret;

public function __construct()
{
$this->middleware('auth', ['except'=>['createPayment', 'executePayment']]);

// Detect if we are running in live mode or sandbox
if(config('paypal.settings.mode') == 'live'){
$this->client_id = config('paypal.live_client_id');
$this->secret = config('paypal.live_secret');
} else {
$this->client_id = config('paypal.sandbox_client_id');
$this->secret = config('paypal.sandbox_secret');
}

// Set the Paypal API Context/Credentials
$this->apiContext = new ApiContext(new OAuthTokenCredential($this->client_id, $this->secret));
$this->apiContext->setConfig(config('paypal.settings'));
}

public function createPayment () {
$payer = new Payer();
$payer->setPaymentMethod("paypal");

$item1 = new Item();
$item1->setName('Ground Coffee 40 oz')
->setCurrency('USD')
->setQuantity(1)
->setSku("123123") // Similar to `item_number` in Classic API
->setPrice(7.5);
$item2 = new Item();
$item2->setName('Granola bars')
->setCurrency('USD')
->setQuantity(5)
->setSku("321321") // Similar to `item_number` in Classic API
->setPrice(2);

$itemList = new ItemList();
$itemList->setItems(array($item1, $item2));

$details = new Details();
$details->setShipping(1.2)
->setTax(1.3)
->setSubtotal(17.50);

$amount = new Amount();
$amount->setCurrency("USD")
->setTotal(20)
->setDetails($details);

$transaction = new Transaction();
$transaction->setAmount($amount)
->setItemList($itemList)
->setDescription("Payment description")
->setInvoiceNumber(uniqid());

$baseUrl = URL::to('/');
$redirectUrls = new RedirectUrls();
$redirectUrls->setReturnUrl("http://online-webstore/paypalRedirect/true")
->setCancelUrl("http://online-webstore/paypalRedirect/false");

$payment = new Payment();
$payment->setIntent("sale")
->setPayer($payer)
->setRedirectUrls($redirectUrls)
->setTransactions(array($transaction));

$request = clone $payment;

try {
$payment->create($this->apiContext);
} catch (Exception $ex) {
exit(1);
}

$approvalUrl = $payment->getApprovalLink();

return $payment;
}

public function executePayment (Request $request) {

$paymentId = $request->paymentID;
$payment = Payment::get($paymentId, $this->apiContext);

$execution = new PaymentExecution();
$execution->setPayerId($request->PayerID);

try {
$result = $payment->execute($execution, $this->apiContext);
} catch (PayPalExceptionPayPalConnectionException $ex) {
echo $ex->getData(); // Prints the detailed error message
die($ex);
}

return $result;
}

}


I have also correctly included my credential in my .env file and running it in sandbox mode.



Can someone direct me where I maybe going wrong also I am happy to provided any more information if required.










share|improve this question























  • Have you echoed config('paypal.settings.mode'), config('paypal.sandbox_client_id'); and config('paypal.sandbox_secret'); to double check that they are correct?

    – Magnus Eriksson
    Jan 20 at 14:37














0












0








0








I am new to PayPal SDK and trying to use the PayPal Checkout SDK in a Laravel application.



I have followed most of the instruction from the following github page, the first call to the function create-payment seems to work; however when I press continue on the PayPal pop-up window to execute the transaction it fails and produces the following error:



Error: Request to post /api/execute-payment failed with 500 error. Correlation id: unknown
{
"message": "Got Http response code 400 when accessing https://api.sandbox.paypal.com/v1/payments/payment/PAY-3RB62059V6076291ALRCHT6Y/execute.",
"exception": "PayPal\Exception\PayPalConnectionException",
"file": "C:\websites\online-webstore\vendor\paypal\rest-api-sdk-php\lib\PayPal\Core\PayPalHttpConnection.php",
"line": 207, {...}


Checking the link: https://api.sandbox.paypal.com/v1/payments/payment/PAY-3RB62059V6076291ALRCHT6Y/execute, I get the error:



{"name":"AUTHENTICATION_FAILURE","message":"Authentication failed due to invalid authentication credentials or a missing Authorization header.","links":[{"href":"https://developer.paypal.com/docs/api/overview/#error","rel":"information_link"}]}


This is my setup so for the client side:



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

<div id="paypal-button"></div>

<script>
paypal.Button.render({
env: 'sandbox', // Or 'production'
// Set up the payment:
// 1. Add a payment callback
payment: function(data, actions) {
// 2. Make a request to your server
return actions.request.post('/api/create-payment')
.then(function(res) {
// 3. Return res.id from the response
return res.id;
});
},
// Execute the payment:
// 1. Add an onAuthorize callback
onAuthorize: function(data, actions) {
// 2. Make a request to your server
return actions.request.post('/api/execute-payment', {
paymentID: data.paymentID,
payerID: data.payerID
})
.then(function(res) {
console.log(res);
alert('PAYMENT WENT THROUGH!!');
}).catch(function(err){
console.log("Error "+err);
});
}
}, '#paypal-button');
</script>


In my controller is set up like so:



class CheckoutController extends Controller
{

private $apiContext;
private $client_id;
private $secret;

public function __construct()
{
$this->middleware('auth', ['except'=>['createPayment', 'executePayment']]);

// Detect if we are running in live mode or sandbox
if(config('paypal.settings.mode') == 'live'){
$this->client_id = config('paypal.live_client_id');
$this->secret = config('paypal.live_secret');
} else {
$this->client_id = config('paypal.sandbox_client_id');
$this->secret = config('paypal.sandbox_secret');
}

// Set the Paypal API Context/Credentials
$this->apiContext = new ApiContext(new OAuthTokenCredential($this->client_id, $this->secret));
$this->apiContext->setConfig(config('paypal.settings'));
}

public function createPayment () {
$payer = new Payer();
$payer->setPaymentMethod("paypal");

$item1 = new Item();
$item1->setName('Ground Coffee 40 oz')
->setCurrency('USD')
->setQuantity(1)
->setSku("123123") // Similar to `item_number` in Classic API
->setPrice(7.5);
$item2 = new Item();
$item2->setName('Granola bars')
->setCurrency('USD')
->setQuantity(5)
->setSku("321321") // Similar to `item_number` in Classic API
->setPrice(2);

$itemList = new ItemList();
$itemList->setItems(array($item1, $item2));

$details = new Details();
$details->setShipping(1.2)
->setTax(1.3)
->setSubtotal(17.50);

$amount = new Amount();
$amount->setCurrency("USD")
->setTotal(20)
->setDetails($details);

$transaction = new Transaction();
$transaction->setAmount($amount)
->setItemList($itemList)
->setDescription("Payment description")
->setInvoiceNumber(uniqid());

$baseUrl = URL::to('/');
$redirectUrls = new RedirectUrls();
$redirectUrls->setReturnUrl("http://online-webstore/paypalRedirect/true")
->setCancelUrl("http://online-webstore/paypalRedirect/false");

$payment = new Payment();
$payment->setIntent("sale")
->setPayer($payer)
->setRedirectUrls($redirectUrls)
->setTransactions(array($transaction));

$request = clone $payment;

try {
$payment->create($this->apiContext);
} catch (Exception $ex) {
exit(1);
}

$approvalUrl = $payment->getApprovalLink();

return $payment;
}

public function executePayment (Request $request) {

$paymentId = $request->paymentID;
$payment = Payment::get($paymentId, $this->apiContext);

$execution = new PaymentExecution();
$execution->setPayerId($request->PayerID);

try {
$result = $payment->execute($execution, $this->apiContext);
} catch (PayPalExceptionPayPalConnectionException $ex) {
echo $ex->getData(); // Prints the detailed error message
die($ex);
}

return $result;
}

}


I have also correctly included my credential in my .env file and running it in sandbox mode.



Can someone direct me where I maybe going wrong also I am happy to provided any more information if required.










share|improve this question














I am new to PayPal SDK and trying to use the PayPal Checkout SDK in a Laravel application.



I have followed most of the instruction from the following github page, the first call to the function create-payment seems to work; however when I press continue on the PayPal pop-up window to execute the transaction it fails and produces the following error:



Error: Request to post /api/execute-payment failed with 500 error. Correlation id: unknown
{
"message": "Got Http response code 400 when accessing https://api.sandbox.paypal.com/v1/payments/payment/PAY-3RB62059V6076291ALRCHT6Y/execute.",
"exception": "PayPal\Exception\PayPalConnectionException",
"file": "C:\websites\online-webstore\vendor\paypal\rest-api-sdk-php\lib\PayPal\Core\PayPalHttpConnection.php",
"line": 207, {...}


Checking the link: https://api.sandbox.paypal.com/v1/payments/payment/PAY-3RB62059V6076291ALRCHT6Y/execute, I get the error:



{"name":"AUTHENTICATION_FAILURE","message":"Authentication failed due to invalid authentication credentials or a missing Authorization header.","links":[{"href":"https://developer.paypal.com/docs/api/overview/#error","rel":"information_link"}]}


This is my setup so for the client side:



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

<div id="paypal-button"></div>

<script>
paypal.Button.render({
env: 'sandbox', // Or 'production'
// Set up the payment:
// 1. Add a payment callback
payment: function(data, actions) {
// 2. Make a request to your server
return actions.request.post('/api/create-payment')
.then(function(res) {
// 3. Return res.id from the response
return res.id;
});
},
// Execute the payment:
// 1. Add an onAuthorize callback
onAuthorize: function(data, actions) {
// 2. Make a request to your server
return actions.request.post('/api/execute-payment', {
paymentID: data.paymentID,
payerID: data.payerID
})
.then(function(res) {
console.log(res);
alert('PAYMENT WENT THROUGH!!');
}).catch(function(err){
console.log("Error "+err);
});
}
}, '#paypal-button');
</script>


In my controller is set up like so:



class CheckoutController extends Controller
{

private $apiContext;
private $client_id;
private $secret;

public function __construct()
{
$this->middleware('auth', ['except'=>['createPayment', 'executePayment']]);

// Detect if we are running in live mode or sandbox
if(config('paypal.settings.mode') == 'live'){
$this->client_id = config('paypal.live_client_id');
$this->secret = config('paypal.live_secret');
} else {
$this->client_id = config('paypal.sandbox_client_id');
$this->secret = config('paypal.sandbox_secret');
}

// Set the Paypal API Context/Credentials
$this->apiContext = new ApiContext(new OAuthTokenCredential($this->client_id, $this->secret));
$this->apiContext->setConfig(config('paypal.settings'));
}

public function createPayment () {
$payer = new Payer();
$payer->setPaymentMethod("paypal");

$item1 = new Item();
$item1->setName('Ground Coffee 40 oz')
->setCurrency('USD')
->setQuantity(1)
->setSku("123123") // Similar to `item_number` in Classic API
->setPrice(7.5);
$item2 = new Item();
$item2->setName('Granola bars')
->setCurrency('USD')
->setQuantity(5)
->setSku("321321") // Similar to `item_number` in Classic API
->setPrice(2);

$itemList = new ItemList();
$itemList->setItems(array($item1, $item2));

$details = new Details();
$details->setShipping(1.2)
->setTax(1.3)
->setSubtotal(17.50);

$amount = new Amount();
$amount->setCurrency("USD")
->setTotal(20)
->setDetails($details);

$transaction = new Transaction();
$transaction->setAmount($amount)
->setItemList($itemList)
->setDescription("Payment description")
->setInvoiceNumber(uniqid());

$baseUrl = URL::to('/');
$redirectUrls = new RedirectUrls();
$redirectUrls->setReturnUrl("http://online-webstore/paypalRedirect/true")
->setCancelUrl("http://online-webstore/paypalRedirect/false");

$payment = new Payment();
$payment->setIntent("sale")
->setPayer($payer)
->setRedirectUrls($redirectUrls)
->setTransactions(array($transaction));

$request = clone $payment;

try {
$payment->create($this->apiContext);
} catch (Exception $ex) {
exit(1);
}

$approvalUrl = $payment->getApprovalLink();

return $payment;
}

public function executePayment (Request $request) {

$paymentId = $request->paymentID;
$payment = Payment::get($paymentId, $this->apiContext);

$execution = new PaymentExecution();
$execution->setPayerId($request->PayerID);

try {
$result = $payment->execute($execution, $this->apiContext);
} catch (PayPalExceptionPayPalConnectionException $ex) {
echo $ex->getData(); // Prints the detailed error message
die($ex);
}

return $result;
}

}


I have also correctly included my credential in my .env file and running it in sandbox mode.



Can someone direct me where I maybe going wrong also I am happy to provided any more information if required.







php laravel laravel-5.6 paypal






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 20 at 14:08









Coder123Coder123

36




36













  • Have you echoed config('paypal.settings.mode'), config('paypal.sandbox_client_id'); and config('paypal.sandbox_secret'); to double check that they are correct?

    – Magnus Eriksson
    Jan 20 at 14:37



















  • Have you echoed config('paypal.settings.mode'), config('paypal.sandbox_client_id'); and config('paypal.sandbox_secret'); to double check that they are correct?

    – Magnus Eriksson
    Jan 20 at 14:37

















Have you echoed config('paypal.settings.mode'), config('paypal.sandbox_client_id'); and config('paypal.sandbox_secret'); to double check that they are correct?

– Magnus Eriksson
Jan 20 at 14:37





Have you echoed config('paypal.settings.mode'), config('paypal.sandbox_client_id'); and config('paypal.sandbox_secret'); to double check that they are correct?

– Magnus Eriksson
Jan 20 at 14:37












1 Answer
1






active

oldest

votes


















0














I had good look through the log file and I noticed the error:



{"name":"VALIDATION_ERROR","details":[{"field":"payer_id","issue":"Payer ID is invalid"}],"message":"Invalid request - see details","information_link":"https://developer.paypal.com/docs/api/payments/#errors","debug_id":"81885e7bbe957"}


It turns out that I made a slight typo in my code:



$execution->setPayerId($request->PayerID);


It should actually be:



$execution->setPayerId($request->payerID);





share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54277277%2fpaypal-php-sdk-authentication-failed-due-to-invalid-authentication-credentials%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I had good look through the log file and I noticed the error:



    {"name":"VALIDATION_ERROR","details":[{"field":"payer_id","issue":"Payer ID is invalid"}],"message":"Invalid request - see details","information_link":"https://developer.paypal.com/docs/api/payments/#errors","debug_id":"81885e7bbe957"}


    It turns out that I made a slight typo in my code:



    $execution->setPayerId($request->PayerID);


    It should actually be:



    $execution->setPayerId($request->payerID);





    share|improve this answer




























      0














      I had good look through the log file and I noticed the error:



      {"name":"VALIDATION_ERROR","details":[{"field":"payer_id","issue":"Payer ID is invalid"}],"message":"Invalid request - see details","information_link":"https://developer.paypal.com/docs/api/payments/#errors","debug_id":"81885e7bbe957"}


      It turns out that I made a slight typo in my code:



      $execution->setPayerId($request->PayerID);


      It should actually be:



      $execution->setPayerId($request->payerID);





      share|improve this answer


























        0












        0








        0







        I had good look through the log file and I noticed the error:



        {"name":"VALIDATION_ERROR","details":[{"field":"payer_id","issue":"Payer ID is invalid"}],"message":"Invalid request - see details","information_link":"https://developer.paypal.com/docs/api/payments/#errors","debug_id":"81885e7bbe957"}


        It turns out that I made a slight typo in my code:



        $execution->setPayerId($request->PayerID);


        It should actually be:



        $execution->setPayerId($request->payerID);





        share|improve this answer













        I had good look through the log file and I noticed the error:



        {"name":"VALIDATION_ERROR","details":[{"field":"payer_id","issue":"Payer ID is invalid"}],"message":"Invalid request - see details","information_link":"https://developer.paypal.com/docs/api/payments/#errors","debug_id":"81885e7bbe957"}


        It turns out that I made a slight typo in my code:



        $execution->setPayerId($request->PayerID);


        It should actually be:



        $execution->setPayerId($request->payerID);






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 20 at 16:27









        Coder123Coder123

        36




        36
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54277277%2fpaypal-php-sdk-authentication-failed-due-to-invalid-authentication-credentials%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How fix org.hibernate.TransientPropertyValueException

            Updating UILabel text programmatically using a function

            Cloud Functions - OpenCV Videocapture Read method fails for larger files from cloud storage