【问题标题】:Symfony2 does not receive response from Authorize.net CIMSymfony2 没有收到来自 Authorize.net CIM 的响应
【发布时间】: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)

【问题讨论】:

标签: php symfony authorize.net


【解决方案1】:

您的 SDK 中的 cert.pem 文件可能已过期。这篇文章的描述为我解决了这个问题:

https://community.developer.authorize.net/t5/The-Authorize-Net-Developer-Blog/Authorize-Net-Begins-Infrastructure-and-SHA-2-Certificate/bc-p/50166#M445

只需将 SDK 中 authnet/lib/ssl 目录中的 cert.pem 文件替换为以下位置的新文件:http://curl.haxx.se/ca/cacert.pem

上面的 authorize.net 链接也参考了这个 SO 问题:cURL requires CURLOPT_SSL_VERIFYPEER=FALSE

【讨论】:

    猜你喜欢
    • 2016-12-11
    • 2021-10-29
    • 1970-01-01
    • 1970-01-01
    • 2013-01-05
    • 2013-01-03
    • 1970-01-01
    • 2015-10-12
    • 1970-01-01
    相关资源
    最近更新 更多