2015-10-13 164 views
2

我正在尝试使用PHP创建Authorize.net定期订阅。 我安装了Composer,然后使用composer.json,如https://github.com/AuthorizeNet/sample-code-php/blob/master/composer.json所示安装Authorize.net SDK。 现在我正尝试使用在此处找到的代码在我的沙盒帐户上创建订阅:https://github.com/AuthorizeNet/sample-code-php/blob/master/RecurringBilling/create-subscription.phpAuthorize.net ARB SSL证书问题

当我尝试运行它,它给了我下面的错误:

Fatal error: Uncaught exception 'Exception' with message 'Error getting valid response from api. Check log file for error details' in /home/tpmadmin/public_html/vendor/authorizenet/authorizenet/lib/net/authorize/api/controller/base/ApiOperationBase.php:122 Stack trace: #0 /home/tpmadmin/public_html/vendor/authorizenet/authorizenet/lib/net/authorize/api/controller/base/ApiOperationBase.php(104): net\authorize\api\controller\base\ApiOperationBase->execute(' https://apitest ...') #1 /home/tpmadmin/public_html/test.php(58): net\authorize\api\controller\base\ApiOperationBase->executeWithApiResponse(' https://apitest ...') #2 {main} thrown in /home/tpmadmin/public_html/vendor/authorizenet/authorizenet/lib/net/authorize/api/controller/base/ApiOperationBase.php on line 122

我检查错误日志和它显示我以下:

Tue, 13 Oct 2015 06:51:05 +0000:CURL ERROR: SSL certificate problem: unable to get local issuer certificate 
Tue, 13 Oct 2015 06:51:22 +0000: Request Serialization Begin 
Tue, 13 Oct 2015 06:51:22 +0000: Request Serialization End 
Tue, 13 Oct 2015 06:51:22 +0000: Url: https://apitest.authorize.net/xml/v1/request.api 
Tue, 13 Oct 2015 06:51:22 +0000:Request to AnetApi: 
<?xml version="1.0" encoding="UTF-8"?> 
<ARBCreateSubscriptionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"> 
    <merchantAuthentication> 
    <name><![CDATA[MY_API_LOGIN]]></name> 
    <transactionKey><![CDATA[MY_TRANSACTION_KEY]]></transactionKey> 
    </merchantAuthentication> 
    <refId><![CDATA[ref1444719082]]></refId> 
    <subscription> 
    <name><![CDATA[Sample Subscription]]></name> 
    <paymentSchedule> 
     <interval> 
     <length>1</length> 
     <unit><![CDATA[months]]></unit> 
     </interval> 
     <startDate><![CDATA[2020-08-30]]></startDate> 
     <totalOccurrences>12</totalOccurrences> 
     <trialOccurrences>1</trialOccurrences> 
    </paymentSchedule> 
    <amount>10.29</amount> 
    <trialAmount>0.00</trialAmount> 
    <payment> 
     <creditCard> 
     <cardNumber><![CDATA[4111111111111111]]></cardNumber> 
     <expirationDate><![CDATA[2020-12]]></expirationDate> 
     </creditCard> 
    </payment> 
    <billTo> 
     <firstName><![CDATA[John]]></firstName> 
     <lastName><![CDATA[Smith]]></lastName> 
    </billTo> 
    </subscription> 
</ARBCreateSubscriptionRequest> 

Sending 'XML' Request type 
Tue, 13 Oct 2015 06:51:22 +0000:Sending http request via Curl 
Tue, 13 Oct 2015 06:51:23 +0000:Response from AnetApi: 


Tue, 13 Oct 2015 06:51:23 +0000:CURL ERROR: SSL certificate problem: unable to get local issuer certificate` 

注:消息以上我取代了我的实际API_LOGIN_ID和TRANSACTION_KEY。真实的消息具有正确的登录信息。

我对SSL证书不太了解,或者可能导致这种情况。我在Google上搜索了几个小时,但没有运气。任何帮助或建议都会很棒!

更新:它工作的真实账户,但不能在沙盒帐户-_-

回答

0

我也有类似的问题,但我只想要授权。

所以,我的情况与authOnly SANDBOX请求我修改HttpClient包括curl_setopt($ curl_request,CURLOPT_SSL_VERIFYPEER,false);

如果我比authOnly要求做更多的,我可能会使用不同的授权API(CIM通过SOAP,例如)

我的一位同行认为,PROD不会给问题,不该” t需要curl_setopt($ curl_request,CURLOPT_SSL_VERIFYPEER,false),但我没有完全测试。

+0

我已经试过这个解决方案,没有运气谢谢你的回应,虽然 – hunijkah