【发布时间】:2015-03-05 22:54:42
【问题描述】:
我正在设置一个 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 文件:github.com/AuthorizeNet/sdk-php
标签: php symfony authorize.net