Search code examples
codeigniterpaypalci-merchant

Security header is not valid in ci-merchant


I am using ci-marchant in one of my application developed with Codeigniter. My environment configuration are:

Codeigniter version: 2.1.4 PHP version: 5.4.12 cURL enabled

I write the following code:

$this->load->helper('language');
$this->load->library('merchant');
$this->merchant->load('paypal_express');
$settings = $this->merchant->default_settings();
$this->merchant->initialize($settings);

$params = array(
    'amount' => 100.00,
    'currency' => 'USD',
    'return_url' => base_url().'payment',
    'cancel_url' => base_url().'payment');

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

Default settings is:

'username' => 'a****_api1.*******.com',
'password' => 'Y9V***YSBE4',
'signature' => 'AFcWxV****v3bYYYRCpSSRl31Ar5*****47c*****x0***4XEB',
'test_mode' => TRUE,
'solution_type' => array('type' => 'select', 'default' => 'Sole', 'options' => array(
                'Sole' => 'merchant_solution_type_sole',
                'Mark' => 'merchant_solution_type_mark')),
'landing_page' => array('type' => 'select', 'default' => 'Billing', 'options' => array(
                'Billing'   => 'merchant_landing_page_billing',
                'Login'     => 'merchant_landing_page_login'))

But it give me the following result:

  protected '_status' => string 'failed' (length=6)
  protected '_message' => string 'Security header is not valid' (length=28)
  protected '_reference' => null
  protected '_data' => null
  protected '_redirect_url' => null
  protected '_redirect_method' => string 'GET' (length=3)
  protected '_redirect_message' => null
  protected '_redirect_data' => null

How can i solve the Security header is not valid problem?

Thanks in advance.


Solution

  • "Security header is not valid" means that you are trying to use a live PayPal account in test mode, or you are trying to use a test PayPal account in live mode.

    In your case, since you have test_mode => TRUE, I'm willing to bet you are using live PayPal credentials instead of ones obtained from http://developer.paypal.com/