我正在设置一个symfony2 Web应用程序,以便在创建用户时,应用程序应该在authorize.net的客户信息管理(CIM)上创建一个配置文件。
我在parameters.yml中设置凭据:
authorizenet_login_id: MY_ACTUAL_LOGIN_ID
authorizenet_tran_key: MY_ACTUAL_KEY
authorizenet_test_mode: true
这是我要求CIM的地方:
public function createUserPaymentProfile(Entity\User $user, $andFlush = true)
{
$paymentProfile = $this->getAuthorizeNetPaymentProfile(
$user->getOriginalCardNumber(),
$user->getExpirationDate()
);
$customerProfile = new \AuthorizeNetCustomer;
$customerProfile->merchantCustomerId = $user->getId();
$customerProfile->email = $user->getEmail();
$customerProfile->paymentProfiles[] = $paymentProfile;
$response = $this->authorizeNetCIM->createCustomerProfile($customerProfile);
if ($response->isOk()) {
$customerProfileId = $response->getCustomerProfileId();
$user->setAuthorizeNetCustomerProfileId($customerProfileId);
$customerPaymentProfileIds = $response->getCustomerPaymentProfileIds();
$customerPaymentProfileId = is_array($customerPaymentProfileIds)
? $customerPaymentProfileIds[0]
: $customerPaymentProfileIds;
$user->setAuthorizeNetCustomerPaymentProfileId($customerPaymentProfileId);
$this->em->persist($user);
if ($andFlush) {
$this->em->flush();
}
}
return $response;
}
但是,我在以下行中没有得到任何回复:
$response = $this->authorizeNetCIM->createCustomerProfile($customerProfile);
这是响应的var_dump:
object(AuthorizeNetCIM_Response)#899 (2) { ["xml"]=> NULL ["response"]=> bool(false) }
更新: 我调试了curl调用,这是我从curl响应得到的错误消息: SSL:证书验证失败(结果:5)
答案 0 :(得分:0)
SDK中的cert.pem文件可能已过期。这篇文章的描述为我解决了这个问题:
只需将SDK中的authnet / lib / ssl目录中的cert.pem文件替换为来自此位置的新文件:http://curl.haxx.se/ca/cacert.pem
上面的authorize.net链接也引用了这个问题:cURL requires CURLOPT_SSL_VERIFYPEER=FALSE