How to debug CI-Merchant Paypal Pro integration?

881 Views Asked by At

I'm trying to use the CI-Merchant library for integrating Paypal Pro (Direct Payment) and I am lost..

I have setup a UK sandbox (both a seller account preconfigured with paypal pro, and a buyer account with the info below ($params array)

Here is the response I'm getting (status failed, no message) along with the $params array I am using:

Merchant_response Object
(
    [_status:protected] => failed
    [_message:protected] => 
    [_reference:protected] => 
    [_data:protected] => 
    [_redirect_url:protected] => 
    [_redirect_method:protected] => GET
    [_redirect_message:protected] => 
    [_redirect_data:protected] => 
)
Array
(
    [card_type] => Visa
    [card_no] => 4269072658337891
    [first_name] => Buyer
    [last_name] => One
    [address1] => 1 Main Terrace
    [city] => Wolverhampton
    [region] => West Midlands
    [postcode] => W12 4LQ
    [amount] => 10
    [currency] => GBP
    [country] => UK
)

And here is the code:

$this->load->library('merchant');
$this->merchant->load('paypal_pro');

$settings = array(
  'username' => '***',
 'password' => '***',
 'signature' => '***',
 'test_mode' => true);

$this->merchant->initialize($settings);

//params array is set through a form submit.
$response = $this->merchant->purchase($params);
echo '<pre>';
print_r($response);
print_r($params);
exit;

Please let me know how to to debug this!

Thank you, Georges

1

There are 1 best solutions below

0
On

after this code

$this->load->library('merchant');
$this->merchant->load('paypal_pro');

you need to initialize

$settings = $this->merchant->default_settings();

and bingo