3
votes

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'=>'[email protected]',
        '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

2
Which version are you using? Did you install from sparks, or the latest master? Sparks is a bit out of date.Adrian Macneil
I installed it manually from github.com/expressodev/ci-merchant/zipball/master, i ended up switching to 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 SparksJason Long
How did you go with this, did you find a solution, Im having a similar problemIEnumerable
Hi, I didnt get CI-Merchant working, I used the github.com/centerax/codeigniter-sage-pay-direct for direct integration and have since used github.com/ollierattue/codeigniter-sagepay-server for the server type integrationJason Long

2 Answers

0
votes

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.

0
votes

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);