I am trying to use CI Merchant library for codeignator here is my code:
$this->load->library('merchant');
$this->merchant->load('paypal_express');
$settings = array(
'username' => 'api.sandbox.paypal.com',
'password' => 'AQHaXxDW3dlKDRDJ7lDtGr4w8-reNNfvPFUKmEr9npMzYjZ2WIbfqqI3VL2C',
'signature' => 'EMbUfhBCqBZw8hhH6q8VZT_53-xwoOs6_lotS68I7qrY5iyHPLgDitrsAZj5',
'test_mode' => true);
$this->merchant->initialize($settings);
$params = array(
'amount' => 100.00,
'currency' => 'USD',
'return_url' => 'https://www.example.com/checkout/payment_return/123',
'cancel_url' => 'https://www.example.com/checkout');
$response = $this->merchant->purchase($params);
echo '<pre>';
print_r($response);
echo '</pre>';
but when I run it local here is result:
Merchant_response Object
(
[_status:protected] => failed
[_message:protected] => error setting certificate verify locations:
CAfile: C:\xampp\htdocs\egyptianornaments\application\config/cacert.pem
CApath: none
[_reference:protected] =>
[_data:protected] =>
[_redirect_url:protected] =>
[_redirect_method:protected] => GET
[_redirect_message:protected] =>
[_redirect_data:protected] =>
)
and when I run on the server I get a blank page so what I am doing wrong?
Looks like your code is setup to use a certificate instead of the signature method, but your servers don't have the SSL cert installed and configured to work with PayPal, which is really sort of a pain to deal with anyway. I would recommend switching to the signature method and then you won't have to mess with that at all.
I'm not familiar with the library you're using, but there must be some way to set that. You might also want to take a look at my own CodeIgniter library for PayPal that is pretty popular.
I've actually stopped maintenance of that CI specific library, though, because I now have my general PHP library for PayPal updated for PHP 5.3+ and working with Composer / Packagist, which allow you to use it in CodeIgniter or any other framework.
As of today, the CI specific library isn't far behind, but again, I'm not updating it anymore. I'm only maintaining the general version now since it works everywhere.
Anyway, it makes every PayPal API call very simple for you.