title: PayPal certificate invalid or not found
body: <p>For the last couple of days, I have been working on realising a payment integration using the PayPal SDK for PHP (which uses the REST API). However, I have been experiencing some issues.</p>
  
  <p>When a payer is redirected to the PayPal site for approving his payment and redirected back to the return URL, PayPal returns a HTTP 400 status code upon executing the approved payment. The code for executing the payment is as follows. Note that $paymentId is the ID returned after creating the payment and $payerId is the PayerID sent along with the approval.</p>
  
  <pre><code>$payment = Payment::get($paymentId);
  $paymentExecution = new PaymentExecution();
  $paymentExecution-&gt;setPayer_id($payerId);
  $payment-&gt;execute($paymentExecution);
  </code></pre>
  
  <p>It says the payment is invalid:</p>
  
  <blockquote>
    <p>{"name":"PAYMENT_STATE_INVALID","message":"This request is invalid due to the current state of the payment","information_link":"<a href="https://developer.paypal.com/docs/api/#PAYMENT_STATE_INVALID" rel="nofollow">https://developer.paypal.com/docs/api/#PAYMENT_STATE_INVALID</a>","debug_id":"223647e6e42fb"} </p>
  </blockquote>
  
  <p>While figuring out where all goes wrong (note that the samples included with the API also give the same error), I stumbled across the following line in my log files:</p>
  
  <blockquote>
    <p>PPHttpConnection: Invalid or no certificate authority found - Retrying using bundled CA certs file</p>
  </blockquote>
  
  <p>I checked to make sure that the SDK locates the certificate included with the SDK. So my guess is that it's an invalid certificate. I'm kind of lost now about what to do. Does anybody have an idea how to fix this issue?</p>