3

I am integrating CI-Merchant into a Codeigniter project for processing payments with Paypal and SagePay.

I have done the demo from http://ci-merchant.org/ for the paypal_express and that worked (or at least gave me a proper error when I used the example code - see below the response with the paypal code)

Merchant_response Object
(
[_status:protected] => failed
[_message:protected] => Security header is not valid
[_reference:protected] => 
[_data:protected] => 
[_redirect_url:protected] => 
[_redirect_method:protected] => GET
[_redirect_message:protected] => 
[_redirect_data:protected] => 
)

I have updated the code for Sagepay and it is as follows

public function index()
{
    $this->load->helper('language');
    $this->load->library('merchant');
    $this->merchant->load('sagepay_direct');

    $settings = array (
        'vendor' => 'testvendor',
        'test_mode' => FALSE,
        'simulator_mode' => TRUE,
    );

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

    $params = array(
        'description'=>'Test purchase',
        'currency'=>'GBP',
        'transaction_id'=>'12345',
        'email'=>'test@person.com',
        'first_name'=>'Test',
        'last_name'=>'Person',
        'address1'=>'1 Random Avenue',
        'address2'=>'Made Up Drive',
        'city'=>'Notarealcity',
        'postcode'=>'FA11 1KE',
        'country'=>'UK',
        'region'=>'',
        'phone'=>'0101010101',

        'amount'=>125.00,
        'card_no'=>'4444444444444444', 
        'name'=> 'Mr Test', 
        'card_type' => 'VISA', 
        'exp_month'=> 11, 
        'exp_year'=> 15,
        'csc'=> 999
    );

    $response = $this->merchant->purchase($params);

    echo '<pre>';
    print_r($response);
    exit;
}

and the output from that code is

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] => 
)

Which isn't giving me any information about what might be wrong.

I am using a valid vendor name and have entered the IP address of the server into the SagePay simulator, the page the request is coming from is https and the URL the request is coming from is added into the sage pay simulator account section.

It looks like it should be good to go but am now stuck - I would really appreciate any help on this.

Thanks in advance

Jason

Jason Long
  • 31
  • 3
  • Which version are you using? Did you install from sparks, or the latest master? Sparks is a bit out of date. – Adrian Macneil Nov 29 '12 at 21:48
  • I installed it manually from https://github.com/expressodev/ci-merchant/zipball/master, i ended up switching to https://github.com/centerax/codeigniter-sage-pay-direct this as I only need Sage Pay for this project and that is working just fine installed via Sparks – Jason Long Dec 03 '12 at 19:59
  • How did you go with this, did you find a solution, Im having a similar problem – IEnumerable Aug 29 '13 at 00:28
  • Hi, I didnt get CI-Merchant working, I used the http://github.com/centerax/codeigniter-sage-pay-direct for direct integration and have since used http://github.com/ollierattue/codeigniter-sagepay-server for the server type integration – Jason Long Aug 30 '13 at 08:40

2 Answers2

0

That PayPal error generally means you are trying to use a live account in test mode, or vice versa.

I'm not sure why Sagepay isn't reporting any errors at all. It might be to do with the lang() function which localises the error messages, but I'm not sure. You might need to add some debugging lines to merchant_sagepay.php to see what the real response is.

Adrian Macneil
  • 13,017
  • 5
  • 57
  • 70
  • Thanks Adrian for taking time to get back to me - maybe i will give it another go when I need to accept more than one payment gateway. – Jason Long Dec 03 '12 at 20:02
0

you are not passing correct parameters in $setting variable

$settings = array(
            'username' => 'API Merchants user name',
            'password' => 'API Merchants passwrd',
            'signature' => 'API Merchants signature',
            'test_mode' => true);// for sand box its true else false
        $this->merchant->initialize($settings); 
Ijaz Ahmed Bhatti
  • 736
  • 1
  • 7
  • 26