[英]Symfony2 does not receive response from Authorize.net CIM
我正在设置一个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)
SDK中的cert.pem文件可能已过期。 这篇文章的描述为我解决了这个问题:
只需使用以下位置的新文件替换SDK中authnet / lib / ssl目录中的cert.pem文件: http : //curl.haxx.se/ca/cacert.pem
上面的authorize.net链接也提到了这样的问题: cURL需要CURLOPT_SSL_VERIFYPEER = FALSE
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.