2015-10-13 131 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