有没有人有幸将SagePay直接与CI-Merchant一起使用?到目前为止,我得到的唯一回应是:
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] =>
)我以前没有使用过SagePay,现在急需让它正常工作。我已经将我的IP地址添加到了SagePay测试区,但并没有在https上测试,因为现在只在我的本地主机上测试。
我的代码看起来像这样:
public function process_payment()
{
$settings = array (
'vendor' => 'XXX',
'test_mode' => TRUE,
'simulator_mode' => FALSE,
);
$this->merchant->initialize($settings);
//get customer details
$this->load->library('custom_cart');
$customer = $this->custom_cart->get_customer_invoice_info();
$customer_name = '';
if ( ! empty($customer['title'])) $customer_name .= $customer['title'] .' ';
$customer_name .= $customer['forename'];
$customer_name .= $customer['surname'];
$customer_street = $customer['address1'];
$customer_street2 = $customer['address2'];
if ( ! empty($customer['address3'])) $customer_street2 .= $customer['address3'];
//order details
$amt = $this->custom_cart->order_total();
$get_curr = $this->custom_cart->get_currency();
$currencycode = $get_curr['name'];
$shippingamt = $this->custom_cart->shipping_cost();
$itemamt = $this->custom_cart->order_subtotal();
$taxamt = '0';
$invnum = $this->custom_cart->customer_order_no();
$params = array(
'description'=> 'Online order',
'currency'=> $currencycode,
'transaction_id'=> $invnum,
'email'=> $customer['email_address'],
'first_name'=> $customer['forename'],
'last_name'=> $customer['surname'],
'address1'=> $customer_street,
'address2'=> $customer_street2,
'city'=> $customer['town_city'],
'postcode'=> $customer['postcode'],
'country'=> $customer['country'],
'region'=> $customer['county'],
'phone'=> $customer['phone'],
'Amount'=> $amt,
'card_no'=> $this->input->post('creditcard'),
'name'=> $customer_name,
'card_type' => $this->input->post('creditcardtype'),
'exp_month'=> $this->input->post('cardmonth'),
'exp_year' => $this->input->post('cardyear'),
'csc'=> $this->input->post('cardsecurecode')
);
$response = $this->merchant->purchase($params);
echo '<pre>';
print_r($response);
}(参数的所有值都是有效的,我已经检查了传递给它们的值是否正确。供应商名称在此处被屏蔽)
发布于 2013-01-30 22:47:28
我终于找到了问题所在--我这一年通过了两位数,这就是它失败的地方(我忘了我之前的商家我加了20个前缀)!谢谢你的帮助。(如果任何人有类似的问题,我通过在函数跟踪中回显每个函数的响应来跟踪它)
https://stackoverflow.com/questions/14584963
复制相似问题