【发布时间】:2015-03-28 08:22:22
【问题描述】:
每次我创建客户资料 ID 时,我都会从授权网获得以下响应,但没有重复,因为它是新创建的客户资料。由于我正在检索用户的电子邮件以创建 authorizenet 配置文件 ID,因此我已经检查了 mysql 数据库中的重复行,但没有。我正在使用 authorize.net 最新的 php sdk。
AuthorizeNetCIM_Response Object
(
[xml] => SimpleXMLElement Object
(
[messages] => SimpleXMLElement Object
(
[resultCode] => Error
[message] => SimpleXMLElement Object
(
[code] => E00039
[text] => A duplicate record with ID 31985206 already exists.
)
)
[customerPaymentProfileIdList] => SimpleXMLElement Object
(
)
[customerShippingAddressIdList] => SimpleXMLElement Object
(
)
[validationDirectResponseList] => SimpleXMLElement Object
(
)
)
[response] => 
我在 Codeigniter 中使用电子邮件确认来创建 Authorizenet 客户 ID
public function email_confirmation(){
//passes the post user id variable to a local variable
$username=$this->uri->segment(3);
//activate user account when confirmed
$confirmation=$this->register_customer_model->user_confirms_email($username);
//$confirmation = TRUE;
if($confirmation==TRUE){
//load authorizenet model
$this->load->model('authorizenet_model');
//create authorizenet profile id
$response=$this->authorizenet_model->create_authorizenet_profile_id($username);
print_r($response);
}
这是使用用户名创建配置文件ID的授权网络模型
public function create_authorizenet_profile_id($username){
//get email from username
$query=$this->db->query("
SELECT email
FROM users
WHERE username='$username'");
foreach ($query->result() as $row){
$email = $row->email;
}
//creates authorizenet profile id
$request = new AuthorizeNetCIM;
$customerProfile = new AuthorizeNetCustomer;
$customerProfile->description = "Bar Express Customer";
$customerProfile->email = $email;
$response = $request->createCustomerProfile($customerProfile);
return $response;
}
【问题讨论】:
标签: php mysql codeigniter authorize.net