2015-05-05 42 views
0

我正在嘗試創建一個php頁面來設置貝寶付款,但不知道如何去做。貝寶付款中的錯誤

我試着從本教程在這裏工作的基本知識: http://paypal.github.io/PayPal-PHP-SDK/sample/doc/payments/CreatePaymentUsingPayPal.html

下面是代碼(我註釋掉的代碼,不工作行):

我有以下問題。

1.)apicontext是另一個文件中的未定義變量,所以我看不到它的聲明。如果有一種方法來解決這個問題,而不調用這個很好的變量。

2)重定向網址我不得不註釋掉,因爲getBaseUrl()是不確定的(在另一個文件)

2)我得到以下錯誤 - 有更多沿着相同的路線:

(!) Warning: error_log(../PayPal.log): failed to open stream: Permission denied in /teaching/courses/co639/vendor/paypal/rest-api-sdk-php/lib/PayPal/Core/PayPalLoggingManager.php on line 116 
Call Stack 
# Time Memory Function Location 
1 0.0017 238856 {main}() ../purchase_create.php:0 
2 0.0135 408648 PayPal\Api\Payment->create() ../purchase_create.php:62 
3 0.0136 409784 PayPal\Common\PayPalResourceModel::executeCall() ../Payment.php:303 
4 0.0140 427152 PayPal\Transport\PayPalRestCall->execute() ../PayPalResourceModel.php:103 
5 0.0144 446320 PayPal\Handler\RestHandler->handle() ../PayPalRestCall.php:71 
6 0.0150 477024 PayPal\Auth\OAuthTokenCredential->getAccessToken() ../RestHandler.php:80 
7 0.0154 480408 PayPal\Auth\OAuthTokenCredential->updateAccessToken() ../OAuthTokenCredential.php:164 
8 0.0154 480712 PayPal\Auth\OAuthTokenCredential->generateAccessToken() ../OAuthTokenCredential.php:212 
9 0.0154 481328 PayPal\Auth\OAuthTokenCredential->getToken() ../OAuthTokenCredential.php:267 
10 0.0157 493288 PayPal\Core\PayPalHttpConnection->execute() ../OAuthTokenCredential.php:243 
11 0.0157 493520 PayPal\Core\PayPalLoggingManager->info() ../PayPalHttpConnection.php:82 
12 0.0157 493968 PayPal\Core\PayPalLoggingManager->log() ../PayPalLoggingManager.php:148 
13 0.0158 494512 error_log () ../PayPalLoggingManager.php:116 

(!) Warning: error_log(../PayPal.log): failed to open stream: Permission denied in /teaching/courses/co639/vendor/paypal/rest-api-sdk-php/lib/PayPal/Core/PayPalLoggingManager.php on line 116 
Call Stack 
# Time Memory Function Location 
1 0.0017 238856 {main}() ../purchase_create.php:0 
2 0.0135 408648 PayPal\Api\Payment->create() ../purchase_create.php:62 
3 0.0136 409784 PayPal\Common\PayPalResourceModel::executeCall() ../Payment.php:303 
4 0.0140 427152 PayPal\Transport\PayPalRestCall->execute() ../PayPalResourceModel.php:103 
5 0.0144 446320 PayPal\Handler\RestHandler->handle() ../PayPalRestCall.php:71 
6 0.0150 477024 PayPal\Auth\OAuthTokenCredential->getAccessToken() ../RestHandler.php:80 
7 0.0154 480408 PayPal\Auth\OAuthTokenCredential->updateAccessToken() ../OAuthTokenCredential.php:164 
8 0.0154 480712 PayPal\Auth\OAuthTokenCredential->generateAccessToken() ../OAuthTokenCredential.php:212 
9 0.0154 481328 PayPal\Auth\OAuthTokenCredential->getToken() ../OAuthTokenCredential.php:267 
10 0.0157 493288 PayPal\Core\PayPalHttpConnection->execute() ../OAuthTokenCredential.php:243 
11 1.2623 502104 PayPal\Core\PayPalLoggingManager->info() ../PayPalHttpConnection.php:157 
12 1.2623 502248 PayPal\Core\PayPalLoggingManager->log() ../PayPalLoggingManager.php:148 
13 1.2623 502496 error_log () 

努力得到這個簡單的例子,爲我工作的任何幫助,讓beasics工作會很好。

+0

這意味着它無法寫入PayPal.log,因此創建該文件並在其上寫入權限。 –

回答