从沙盒切换到live paypal时出现以下错误。请帮我解决此错误。
Array
(
[TIMESTAMP] => 2015-06-10T01:59:03Z
[CORRELATIONID] => 4ce24a1abd742
[ACK] => Failure
[VERSION] => 85.0
[BUILD] => 16770825
[L_ERRORCODE0] => 10501
[L_SHORTMESSAGE0] => Invalid Configuration
[L_LONGMESSAGE0] => This transaction cannot be processed due to an invalid merchant configuration.
[L_SEVERITYCODE0] => Error
[AMT] => 555.00
[CURRENCYCODE] => USD
)
控制器:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Checkout extends CI_Controller {
public function direct_payment() {
$item = $this->session->userdata['item_data']['item'];
$price = $this->session->userdata['item_data']['price'];
$quantity = $this->session->userdata['item_data']['quantity'];
$card_type = $this->input->post('card_type');
$card_fname = $this->input->post('card_fname');
$card_lname = $this->input->post('card_lname');
$creditcard_number = $this->input->post('creditcard_number');
$crd_month=$this->input->post('crd_month');
$crd_year=$this->input->post('crd_year');
$security_code=$this->input->post('security_code');
//$order_id = $this->payment_model->save_order();
$respounse = $this->payment_model->do_direct_payment($card_type,$card_fname,$card_lname,$creditcard_number,$crd_month,$crd_year,$security_code);
echo '<pre>';
print_r($respounse);
exit;
if($respounse['ACK'] == 'SuccessWithWarning' or $respounse['ACK']== 'Success' or $respounse['ACK']== 'Pending') {
//$this->db->update('orders', array('order_status'=>'New', 'transaction_id'=>$respounse['TRANSACTIONID'], 'payment_type' =>'Credit Card',
//'payment_status' =>$respounse['ACK'],'payment_recevied'=>$respounse['AMT'], 'payment_symbol'=>$respounse['CURRENCYCODE']), array('id'=> $order_id));
//$this->cart->destroy();
//$this->session->set_userdata(array(
//'last_id'=> $order_id,'transaction'=>$respounse['TRANSACTIONID']));
$this->session->set_flashdata("succes","Your Order is succesfully placed.");
redirect("contents/credit");
} else {
//$this->db->update('orders', array('order_status'=>'Failed', 'payment_type' =>'Credit Card',
//'payment_status' =>$respounse['ACK']), array('id'=> $order_id));
$this->session->set_flashdata("error","Error occur in your payment transacion.");
redirect("contents/credit");
}
}
}
型号:
class payment_model extends CI_Model {
function do_direct_payment($card_type,$card_fname,$card_lname,$creditcard_number,$crd_month,$crd_year,$security_code) {
$sandbox = TRUE;
// Set PayPal API version and credentials.
$api_version = '85.0';
$api_endpoint = ($sandbox == 0 )? 'https://api-3t.sandbox.paypal.com/nvp' : 'https://api-3t.paypal.com/nvp';
$api_username = ($sandbox == 0) ? '------' : '-------';
$api_password = ($sandbox == 0) ? '-------' : '------';
$api_signature = ($sandbox == 0) ? '--------' : '-------';
$request_params = array (
'METHOD' => 'DoDirectPayment',
'USER' => $api_username,
'PWD' => $api_password,
'SIGNATURE' => $api_signature,
'VERSION' => $api_version,
'PAYMENTACTION' => 'Sale',
'IPADDRESS' => $_SERVER['REMOTE_ADDR'],
'CREDITCARDTYPE' => $card_type,
'ACCT' => $creditcard_number,
'EXPDATE' => $crd_month.$crd_year,
'CVV2' => $security_code,
'FIRSTNAME' => 'ibad',
'LASTNAME' => 'anjum',
'STREET' => '11 gg',
'CITY' => 'peshawar',
'STATE' => 'state',
'COUNTRYCODE' => 'PK',
'ZIP' => '10200',
'EMAIL' => '-----',
'AMT' => 555,
'CURRENCYCODE' => 'USD',
'DESC' => 'Testing Payments Pro'
);
// Loop through $request_params array to generate the NVP string.
$nvp_string = '';
foreach($request_params as $var=>$val)
{
$nvp_string .= '&'.$var.'='.urlencode($val);
}
// Send NVP string to PayPal and store response
$curl = curl_init();
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_URL, $api_endpoint);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $nvp_string);
$result = curl_exec($curl);
//print_r($result);
return $result_array = $this->NVPToArray($result);
}
public function NVPToArray($NVPString) {
$proArray = array();
while(strlen($NVPString)) {
// name
$keypos= strpos($NVPString,'=');
$keyval = substr($NVPString,0,$keypos);
// value
$valuepos = strpos($NVPString,'&') ? strpos($NVPString,'&'): strlen($NVPString);
$valval = substr($NVPString,$keypos+1,$valuepos-$keypos-1);
// decoding the respose
$proArray[$keyval] = urldecode($valval);
$NVPString = substr($NVPString,$valuepos+1,strlen($NVPString));
}
return $proArray;
}
}
答案 0 :(得分:2)
根据文档,当帐单协议被停用或处于非活动状态时,会出现错误代码10501。您应该在帐户中启用PayPal Payment Pro。 您可以尝试执行以下操作::
打开您的developer.paypal.com帐户。
打开应用以访问您的帐户。
点击您要升级到付款专业版的帐户。
点击个人资料,在对话框中找到升级到专业版的选项。
答案 1 :(得分:0)
如果它适用于您的沙箱,那么在我看来是一个帐户问题。
对于帐户问题,我建议您与PayPal联系(http://www.paypal.com的底部),他们将得到合适的团队为您提供支持。
即使稍后他们发现它是技术性的,他们也会要求商家技术服务部门提供支持。但同样,我认为这是帐户问题。他们将指导您完成必要的过程。