StuBlackett
StuBlackett

Reputation: 3857

Laravel PayPal API Returning 500 Error

I'm using Laravel 4.2 for my site, I'm setting up a payment. It seems to get to PayPal fine, But when returning back to my site, I get a 500 Error...

Got Http response code 500 when accessing https://api.sandbox.paypal.com/v1/payments/payment/PAY-6FJ919999H125543PK3G4NAY/execute. 

I am logging things and can see, Just before the 500 kicks in I get the following in the log :

[24-02-2016 03:05:08] PayPal\Core\PayPalHttpConnection: INFO    : Response Status   : 200
[24-02-2016 03:05:08] PayPal\Core\PayPalHttpConnection: INFO    : POST https://api.sandbox.paypal.com/v1/payments/payment/PAY-6FJ919999H125543PK3G4NAY/execute
[24-02-2016 03:05:08] PayPal\Core\PayPalHttpConnection: INFO    : Invalid or no certificate authority found - Retrying using bundled CA certs file
[24-02-2016 03:05:23] PayPal\Core\PayPalHttpConnection: INFO    : Response Status   : 500
[24-02-2016 03:05:23] PayPal\Core\PayPalHttpConnection: ERROR   : Got Http response code 500 when accessing https://api.sandbox.paypal.com/v1/payments/payment/PAY-6FJ919999H125543PK3G4NAY/execute. {"name":"INTERNAL_SERVICE_ERROR","message":"An internal service error has occurred","information_link":"https://developer.paypal.com/docs/api/#INTERNAL_SERVICE_ERROR","debug_id":"fdefbd463f7b7"}

My Laravel Code is as follows (PayPal Return)

public function getPaymentStatus()
    {
        // Get the payment ID before session clear
        $payment_id = Session::get('paypal_payment_id');

        // clear the session payment ID
        //Session::forget('paypal_payment_id');

        $payerID = Input::get('PayerID');
        $token = Input::get('token');

        if(empty($payerID) || empty($token))
        {
            // Payment Failed....
            Flash::error('Payment Failed!');
            Redirect::back();
        }

        $payment = Payment::get($payment_id, $this->_api_context);

        // PaymentExecution object includes information necessary
        // to execute a PayPal account payment.
        // The payer_id is added to the request query parameters
        // when the user is redirected from paypal back to your site
        $execution = new PaymentExecution();
        $execution->setPayerId(Input::get('PayerID'));

        //Execute the payment
        $result = $payment->execute($execution, $this->_api_context);

        echo "Session Data....";
        echo "<hr />";
        echo "<pre>";
        var_dump(Session::all());
        echo "</pre>";

        echo '<pre>';print_r($result);echo '</pre>';exit; // DEBUG RESULT, remove it later

        if ($result->getState() == 'approved')
        {
            // Payment Made (Now Set Account To Active & Set Users' Options)...

            // Also Check Where Referrer Was (If was register - set account up)
            dd(Session::all());

        }
        return Redirect::route('original.route')
            ->with('error', 'Payment failed');
    }

It is also worth pointing out, That I am working on a local install. This may also be any issue? Not sure

Thank You!

Upvotes: 0

Views: 739

Answers (1)

Zhao Samanta
Zhao Samanta

Reputation: 1095

This error message "Invalid or no certificate authority found - Retrying using bundled CA certs file" indicates the certificate file issue. please download the latest certificate file and place it in keystore. Refer to https://www.paypal-knowledge.com/infocenter/index?page=content&widgetview=true&id=FAQ1766&viewlocale=en_US

Upvotes: 1

Related Questions