2012-11-29 25 views
3

我正在將CI-Merchant集成到Codeigniter項目中,以處理使用Paypal和SagePay進行的付款。CI-Merchant&SagePay - 似乎無法讓它做出任何響應

我也做了演示從http://ci-merchant.org/的paypal_express和工作(或當我使用的示例代碼,至少給了我正確的錯誤 - 看到與貝寶碼的響應下)

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

我已經更新了代碼Sagepay,它是如下

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

,並從該代碼輸出是

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

這不是給我關於什麼可能是錯的信息。

我使用的是有效的供應商名稱,並將服務器的IP地址輸入到SagePay模擬器中,請求來自的頁面是https,請求來自的URL被添加到sage pay模擬器帳戶部分。

它看起來應該很好去,但我現在卡住了 - 我真的很感激任何幫助。

在此先感謝

傑森

+0

哪個版本您使用的?你是否從火花或最新的主人安裝? Sparks有點過時了。 –

+0

我從https://github.com/expressodev/ci-merchant/zipball/master手動安裝它,我結束了切換到https://github.com/centerax/codeigniter-sage-pay-direct這隻作爲我需要Sage支付這個項目,並通過Sparks工作很好安裝 –

+0

你是如何去與此,你找到一個解決方案,我有一個類似的問題 – IEnumerable

回答

0

,貝寶錯誤通常意味着你試圖在測試模式下使用真實賬戶,反之亦然。

我不確定爲什麼Sagepay根本沒有報告任何錯誤。它可能是用lang()函數來定位錯誤信息,但我不確定。您可能需要向merchant_sagepay.php添加一些調試行以查看真實的響應。

+0

感謝Adrian花時間獲取回到我身邊 - 也許當我需要接受多個支付網關時,我會再給它一次。 –

0

你沒有傳遞正確的參數$setting變量

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